Skip to content

Commit 61122b4

Browse files
committed
sendtables: simplified numBits calculation
1 parent 5b3f84a commit 61122b4

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

sendtables/propdecoder.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -282,13 +282,7 @@ func (propertyDecoder) decodeVector(prop *sendTableProperty, reader *bit.BitRead
282282
}
283283

284284
func (propertyDecoder) decodeArray(fProp *flattenedPropEntry, reader *bit.BitReader) []PropertyValue {
285-
numElement := fProp.prop.numberOfElements
286-
287-
numBits := 1
288-
289-
for maxElements := (numElement >> 1); maxElements != 0; maxElements >>= 1 {
290-
numBits++
291-
}
285+
numBits := int(math.Floor(math.Log2(float64(fProp.prop.numberOfElements))) + 1)
292286

293287
res := make([]PropertyValue, int(reader.ReadInt(numBits)))
294288

0 commit comments

Comments
 (0)