diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2017-05-23 17:15:49 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2017-05-23 17:24:07 +0800 |
commit | e1e87d8b1aebe88354e2f64ffd031709524522e4 (patch) | |
tree | e848788091ca09aa8b1844e663772e152869a9f6 | |
parent | 10582a97ca3d147b29e1ca1c4069ce785a3ebde7 (diff) | |
download | go-tangerine-e1e87d8b1aebe88354e2f64ffd031709524522e4.tar go-tangerine-e1e87d8b1aebe88354e2f64ffd031709524522e4.tar.gz go-tangerine-e1e87d8b1aebe88354e2f64ffd031709524522e4.tar.bz2 go-tangerine-e1e87d8b1aebe88354e2f64ffd031709524522e4.tar.lz go-tangerine-e1e87d8b1aebe88354e2f64ffd031709524522e4.tar.xz go-tangerine-e1e87d8b1aebe88354e2f64ffd031709524522e4.tar.zst go-tangerine-e1e87d8b1aebe88354e2f64ffd031709524522e4.zip |
common: fixed byte padding functions
Byte padding function should return the given slice if the length is
smaller or equal rather than *only* smaller than.
This fix improves almost all EVM push operations.
-rw-r--r-- | common/bytes.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/common/bytes.go b/common/bytes.go index 0342083a1..c445968f2 100644 --- a/common/bytes.go +++ b/common/bytes.go @@ -89,18 +89,18 @@ func Hex2BytesFixed(str string, flen int) []byte { } func RightPadBytes(slice []byte, l int) []byte { - if l < len(slice) { + if l <= len(slice) { return slice } padded := make([]byte, l) - copy(padded[0:len(slice)], slice) + copy(padded, slice) return padded } func LeftPadBytes(slice []byte, l int) []byte { - if l < len(slice) { + if l <= len(slice) { return slice } |