Adds 'reserve' to either end of the range between 'min' and 'max' while staying in the range of T.
| 681 | // Adds 'reserve' to either end of the range between 'min' and 'max' while |
| 682 | // staying in the range of T. |
| 683 | void extendRange(int64_t reserve, int64_t& min, int64_t& max) { |
| 684 | int64_t kMin = std::numeric_limits<T>::min(); |
| 685 | int64_t kMax = std::numeric_limits<T>::max(); |
| 686 | if (kMin + reserve + 1 > min) { |
| 687 | min = kMin; |
| 688 | } else { |
| 689 | min -= reserve; |
| 690 | } |
| 691 | if (kMax - reserve < max) { |
| 692 | max = kMax; |
| 693 | } else { |
| 694 | max += reserve; |
| 695 | } |
| 696 | } |
| 697 | |
| 698 | // Adds 'reservePct' % to either end of the range between 'min' and 'max' |
| 699 | // while staying in the range of 'kind'. |
no test coverage detected