From 7b35e0f0b8bd5c806ddf1734592e52a3f03be0d6 Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Wed, 20 Aug 2014 15:06:29 +0200 Subject: [PATCH] Use constants from math package instead of literals. Change-Id: I55427ba32c2cbb32ee42ec1e3153160965ab8b3c --- storage/local/delta.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/storage/local/delta.go b/storage/local/delta.go index aea880408..5271bb9a6 100644 --- a/storage/local/delta.go +++ b/storage/local/delta.go @@ -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 {