aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2019-09-10 22:12:06 +0800
committerGitHub <noreply@github.com>2019-09-10 22:12:06 +0800
commit305ed955db2e4db840a03613e058d65bd880b900 (patch)
treec90cce47ca08732656d17e0a477916365747c00b /common
parent46b437f39c66d228294acb76878fea890af77949 (diff)
parent72045dff4f766d4b8332f126e377ab54a683276e (diff)
downloadgo-tangerine-305ed955db2e4db840a03613e058d65bd880b900.tar
go-tangerine-305ed955db2e4db840a03613e058d65bd880b900.tar.gz
go-tangerine-305ed955db2e4db840a03613e058d65bd880b900.tar.bz2
go-tangerine-305ed955db2e4db840a03613e058d65bd880b900.tar.lz
go-tangerine-305ed955db2e4db840a03613e058d65bd880b900.tar.xz
go-tangerine-305ed955db2e4db840a03613e058d65bd880b900.tar.zst
go-tangerine-305ed955db2e4db840a03613e058d65bd880b900.zip
Merge pull request #20038 from holiman/minor_encodingfix
core/state: optimize some internals during encoding
Diffstat (limited to 'common')
-rw-r--r--common/bytes.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/common/bytes.go b/common/bytes.go
index 910c97d3c..fa457b92c 100644
--- a/common/bytes.go
+++ b/common/bytes.go
@@ -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:]
+}