Skip to content

Commit 76b98bb

Browse files
committed
Update based on review
1 parent 3028527 commit 76b98bb

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

serialization/serialization.go

+3-13
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"errors"
1212
"fmt"
1313
"io"
14+
"math/bits"
1415
"slices"
1516
"strings"
1617
)
@@ -298,17 +299,6 @@ func decodeVar(r io.ReadSeeker, unsigned bool) (interface{}, error) {
298299
return int64(tNum >> (tb + 2)), nil
299300
}
300301

301-
func trailingOneBitCount(b byte) (count int) {
302-
var i byte = 0x1
303-
for {
304-
if b&i == 0 {
305-
break
306-
}
307-
count++
308-
if i >= 0x80 {
309-
break
310-
}
311-
i = i << 1
312-
}
313-
return
302+
func trailingOneBitCount(b byte) int {
303+
return bits.TrailingZeros8(^b)
314304
}

0 commit comments

Comments
 (0)