From fd2900820b39feca173f4e4172f6734f294278c2 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Tue, 4 Sep 2018 14:29:58 +0200 Subject: [PATCH] accounts/abi: move limit variables out of function --- accounts/abi/unpack.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/accounts/abi/unpack.go b/accounts/abi/unpack.go index c27d552b93..d5875140cc 100644 --- a/accounts/abi/unpack.go +++ b/accounts/abi/unpack.go @@ -25,16 +25,17 @@ import ( "github.com/ethereum/go-ethereum/common" ) -// reads the integer based on its kind -func readInteger(typ byte, kind reflect.Kind, b []byte) interface{} { - var maxUint256 = big.NewInt(0).Add( +var ( + maxUint256 = big.NewInt(0).Add( big.NewInt(0).Exp(big.NewInt(2), big.NewInt(256), nil), big.NewInt(-1)) - - var maxInt256 = big.NewInt(0).Add( + maxInt256 = big.NewInt(0).Add( big.NewInt(0).Exp(big.NewInt(2), big.NewInt(255), nil), big.NewInt(-1)) +) +// reads the integer based on its kind +func readInteger(typ byte, kind reflect.Kind, b []byte) interface{} { switch kind { case reflect.Uint8: return b[len(b)-1]