mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-10 07:34:04 -08:00
Use constants from math package instead of literals.
Change-Id: I55427ba32c2cbb32ee42ec1e3153160965ab8b3c
This commit is contained in:
parent
15929eece2
commit
7b35e0f0b8
|
@ -83,13 +83,13 @@ func (c *deltaEncodedChunk) clone() chunk {
|
|||
|
||||
func neededDeltaBytes(deltaT clientmodel.Timestamp, deltaV clientmodel.SampleValue, isInt bool) (dtb, dvb deltaBytes) {
|
||||
dtb = d1
|
||||
if deltaT >= 256 {
|
||||
if deltaT > math.MaxUint8 {
|
||||
dtb = d2
|
||||
}
|
||||
if deltaT >= 256*256 {
|
||||
if deltaT > math.MaxUint16 {
|
||||
dtb = d4
|
||||
}
|
||||
if deltaT >= 256*256*256*256 {
|
||||
if deltaT > math.MaxUint32 {
|
||||
dtb = d8
|
||||
}
|
||||
|
||||
|
@ -98,13 +98,13 @@ func neededDeltaBytes(deltaT clientmodel.Timestamp, deltaV clientmodel.SampleVal
|
|||
if deltaV != 0 {
|
||||
dvb = d1
|
||||
}
|
||||
if deltaV < -(256/2) || deltaV > (256/2)-1 {
|
||||
if deltaV < math.MinInt8 || deltaV > math.MaxInt8 {
|
||||
dvb = d2
|
||||
}
|
||||
if deltaV < -(256*256/2) || deltaV > (256*256/2)-1 {
|
||||
if deltaV < math.MinInt16 || deltaV > math.MaxInt16 {
|
||||
dvb = d4
|
||||
}
|
||||
if deltaV < -(256*256*256*256/2) || deltaV > (256*256*256*256/2)-1 {
|
||||
if deltaV < math.MinInt32 || deltaV > math.MaxInt32 {
|
||||
dvb = d8
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue