Merge pull request #20038 from holiman/minor_encodingfix

core/state: optimize some internals during encoding
This commit is contained in:
Péter Szilágyi
2019-09-10 17:12:06 +03:00
committed by GitHub
3 changed files with 82 additions and 1 deletions

View File

@ -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:]
}