MCPcopy Create free account
hub / github.com/bytedance/bolt / extendRange

Function extendRange

bolt/exec/VectorHasher.cpp:683–696  ·  view source on GitHub ↗

Adds 'reserve' to either end of the range between 'min' and 'max' while staying in the range of T.

Source from the content-addressed store, hash-verified

681// Adds 'reserve' to either end of the range between 'min' and 'max' while
682// staying in the range of T.
683void 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'.

Callers 2

cardinalityMethod · 0.85
enableValueRangeMethod · 0.85

Calls 2

minFunction · 0.50
maxFunction · 0.50

Tested by

no test coverage detected