diff --git a/encoding.go b/encoding.go index 98c1acf8..da939070 100644 --- a/encoding.go +++ b/encoding.go @@ -136,7 +136,7 @@ func newBufferFromInt(num uint64) *byteBuffer { data := make([]byte, 8) binary.BigEndian.PutUint64(data, num) return &byteBuffer{ - data: trimZeros(data), + data: bytes.TrimLeft(data, "\x00"), } } @@ -184,15 +184,3 @@ func (b byteBuffer) bigInt() *big.Int { func (b byteBuffer) toInt() int { return int(b.bigInt().Int64()) } - -func trimZeros(data []byte) []byte { - i := 0 - for _, b := range data { - if b == 0 { - i++ - } else { - break - } - } - return data[i:] -}