File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -34,11 +34,10 @@ import (
34
34
"encoding/hex"
35
35
"fmt"
36
36
"math/big"
37
+ "math/bits"
37
38
"strconv"
38
39
)
39
40
40
- const uintBits = 32 << (uint64 (^ uint (0 )) >> 63 )
41
-
42
41
// Errors
43
42
var (
44
43
ErrEmptyString = & decError {"empty hex string" }
48
47
ErrEmptyNumber = & decError {"hex string \" 0x\" " }
49
48
ErrLeadingZero = & decError {"hex number with leading zero digits" }
50
49
ErrUint64Range = & decError {"hex number > 64 bits" }
51
- ErrUintRange = & decError {fmt .Sprintf ("hex number > %d bits" , uintBits )}
50
+ ErrUintRange = & decError {fmt .Sprintf ("hex number > %d bits" , bits . UintSize )}
52
51
ErrBig256Range = & decError {"hex number > 256 bits" }
53
52
)
54
53
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import (
22
22
"encoding/json"
23
23
"errors"
24
24
"math/big"
25
+ "math/bits"
25
26
"testing"
26
27
27
28
"github.com/holiman/uint256"
@@ -384,7 +385,7 @@ func TestUnmarshalUint(t *testing.T) {
384
385
for _ , test := range unmarshalUintTests {
385
386
var v Uint
386
387
err := json .Unmarshal ([]byte (test .input ), & v )
387
- if uintBits == 32 && test .wantErr32bit != nil {
388
+ if bits . UintSize == 32 && test .wantErr32bit != nil {
388
389
checkError (t , test .input , err , test .wantErr32bit )
389
390
continue
390
391
}
You can’t perform that action at this time.
0 commit comments