mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/encoding: substitute 64-bits.LeadingZeros64()
with bits.Len64()
This commit is contained in:
parent
a8509c112a
commit
e13ce2ee98
1 changed files with 2 additions and 2 deletions
|
@ -93,7 +93,7 @@ func nearestDelta(next, prev int64, precisionBits, prevTrailingZeros uint8) (int
|
||||||
// There is no need in handling special case origin = -1<<63.
|
// There is no need in handling special case origin = -1<<63.
|
||||||
}
|
}
|
||||||
|
|
||||||
originBits := 64 - uint8(bits.LeadingZeros64(uint64(origin)))
|
originBits := uint8(bits.Len64(uint64(origin)))
|
||||||
if originBits <= precisionBits {
|
if originBits <= precisionBits {
|
||||||
// Cannot zero trailing bits for the given precisionBits.
|
// Cannot zero trailing bits for the given precisionBits.
|
||||||
return d, decIfNonZero(prevTrailingZeros)
|
return d, decIfNonZero(prevTrailingZeros)
|
||||||
|
@ -136,7 +136,7 @@ func getTrailingZeros(v int64, precisionBits uint8) uint8 {
|
||||||
v = -v
|
v = -v
|
||||||
// There is no need in special case handling for v = -1<<63
|
// There is no need in special case handling for v = -1<<63
|
||||||
}
|
}
|
||||||
vBits := 64 - uint8(bits.LeadingZeros64(uint64(v)))
|
vBits := uint8(bits.Len64(uint64(v)))
|
||||||
if vBits <= precisionBits {
|
if vBits <= precisionBits {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue