aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2017-05-23 17:15:49 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2017-05-23 17:24:07 +0800
commite1e87d8b1aebe88354e2f64ffd031709524522e4 (patch)
treee848788091ca09aa8b1844e663772e152869a9f6 /common
parent10582a97ca3d147b29e1ca1c4069ce785a3ebde7 (diff)
downloaddexon-e1e87d8b1aebe88354e2f64ffd031709524522e4.tar
dexon-e1e87d8b1aebe88354e2f64ffd031709524522e4.tar.gz
dexon-e1e87d8b1aebe88354e2f64ffd031709524522e4.tar.bz2
dexon-e1e87d8b1aebe88354e2f64ffd031709524522e4.tar.lz
dexon-e1e87d8b1aebe88354e2f64ffd031709524522e4.tar.xz
dexon-e1e87d8b1aebe88354e2f64ffd031709524522e4.tar.zst
dexon-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.
Diffstat (limited to 'common')
-rw-r--r--common/bytes.go6
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
}