Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions go-ethereum/common/hexutil/hexutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ import (
"encoding/hex"
"fmt"
"math/big"
"math/bits"
"strconv"
)

const uintBits = 32 << (uint64(^uint(0)) >> 63)

// Errors
var (
ErrEmptyString = &decError{"empty hex string"}
Expand All @@ -48,7 +47,7 @@ var (
ErrEmptyNumber = &decError{"hex string \"0x\""}
ErrLeadingZero = &decError{"hex number with leading zero digits"}
ErrUint64Range = &decError{"hex number > 64 bits"}
ErrUintRange = &decError{fmt.Sprintf("hex number > %d bits", uintBits)}
ErrUintRange = &decError{fmt.Sprintf("hex number > %d bits", bits.UintSize)}
ErrBig256Range = &decError{"hex number > 256 bits"}
)

Expand Down
3 changes: 2 additions & 1 deletion go-ethereum/common/hexutil/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"encoding/json"
"errors"
"math/big"
"math/bits"
"testing"

"github.com/holiman/uint256"
Expand Down Expand Up @@ -384,7 +385,7 @@ func TestUnmarshalUint(t *testing.T) {
for _, test := range unmarshalUintTests {
var v Uint
err := json.Unmarshal([]byte(test.input), &v)
if uintBits == 32 && test.wantErr32bit != nil {
if bits.UintSize == 32 && test.wantErr32bit != nil {
checkError(t, test.input, err, test.wantErr32bit)
continue
}
Expand Down
Loading