core/state: optimize some internals during encoding
This commit is contained in:
@ -134,3 +134,14 @@ func LeftPadBytes(slice []byte, l int) []byte {
|
||||
|
||||
return padded
|
||||
}
|
||||
|
||||
// TrimLeftZeroes returns a subslice of s without leading zeroes
|
||||
func TrimLeftZeroes(s []byte) []byte {
|
||||
idx := 0
|
||||
for ; idx < len(s); idx++ {
|
||||
if s[idx] != 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return s[idx:]
|
||||
}
|
||||
|
Reference in New Issue
Block a user