Fix overflow issues
parent
149b1cef1d
commit
ebc92ca04f
|
@ -52,7 +52,7 @@ func (blk *MeasurementBlock) Version() int { return blk.version }
|
||||||
func (blk *MeasurementBlock) Elem(name []byte) (e MeasurementElem, ok bool) {
|
func (blk *MeasurementBlock) Elem(name []byte) (e MeasurementElem, ok bool) {
|
||||||
n := binary.BigEndian.Uint32(blk.hashData[:MeasurementNSize])
|
n := binary.BigEndian.Uint32(blk.hashData[:MeasurementNSize])
|
||||||
hash := hashKey(name)
|
hash := hashKey(name)
|
||||||
pos := int(hash) % int(n)
|
pos := int(hash % n)
|
||||||
|
|
||||||
// Track current distance
|
// Track current distance
|
||||||
var d int
|
var d int
|
||||||
|
|
|
@ -63,7 +63,7 @@ func (ts *TagSet) Version() int { return ts.version }
|
||||||
func (ts *TagSet) TagKeyElem(key []byte) TagKeyElem {
|
func (ts *TagSet) TagKeyElem(key []byte) TagKeyElem {
|
||||||
keyN := binary.BigEndian.Uint32(ts.hashData[:TagKeyNSize])
|
keyN := binary.BigEndian.Uint32(ts.hashData[:TagKeyNSize])
|
||||||
hash := hashKey(key)
|
hash := hashKey(key)
|
||||||
pos := int(hash) % int(keyN)
|
pos := int(hash % keyN)
|
||||||
|
|
||||||
// Track current distance
|
// Track current distance
|
||||||
var d int
|
var d int
|
||||||
|
@ -107,7 +107,7 @@ func (ts *TagSet) TagValueElem(key, value []byte) TagValueElem {
|
||||||
hashData := ts.data[kelem.Offset:]
|
hashData := ts.data[kelem.Offset:]
|
||||||
valueN := binary.BigEndian.Uint32(hashData[:TagValueNSize])
|
valueN := binary.BigEndian.Uint32(hashData[:TagValueNSize])
|
||||||
hash := hashKey(value)
|
hash := hashKey(value)
|
||||||
pos := int(hash) % int(valueN)
|
pos := int(hash % valueN)
|
||||||
|
|
||||||
// Track current distance
|
// Track current distance
|
||||||
var d int
|
var d int
|
||||||
|
|
Loading…
Reference in New Issue