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

Method enableValueRange

bolt/exec/VectorHasher.cpp:804–823  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

802}
803
804uint64_t VectorHasher::enableValueRange(
805 uint64_t multiplier,
806 int32_t reservePct) {
807 multiplier_ = multiplier;
808 BOLT_CHECK_LE(0, reservePct);
809 BOLT_CHECK(hasRange_);
810 extendRange(type_->kind(), reservePct, min_, max_);
811 isRange_ = true;
812 // No overflow because max range is under 63 bits.
813 if (typeKind_ == TypeKind::BOOLEAN) {
814 rangeSize_ = 3;
815 } else {
816 rangeSize_ = (max_ - min_) + 2;
817 }
818 uint64_t result;
819 if (__builtin_mul_overflow(multiplier_, rangeSize_, &result)) {
820 return kRangeTooLarge;
821 }
822 return result;
823}
824
825void VectorHasher::copyStatsFrom(const VectorHasher& other) {
826 hasRange_ = other.hasRange_;

Callers 5

setHasherModeMethod · 0.80
testComputeValueIdsMethod · 0.80
TEST_FFunction · 0.80
benchmarkComputeValueIdsFunction · 0.80
computeValueIdsMethod · 0.80

Calls 2

extendRangeFunction · 0.85
kindMethod · 0.45

Tested by 2

testComputeValueIdsMethod · 0.64
TEST_FFunction · 0.64