pkg/math/bits: reduce maximum bit index

to be compatible with 32-bit architectures.

Fixes #227.

Change-Id: I57d744c989948ad0e29f43d56f8e930548ff0212
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/4401
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/cue/builtins.go b/cue/builtins.go
index 7c5dd8f..e9eca40 100644
--- a/cue/builtins.go
+++ b/cue/builtins.go
@@ -1847,7 +1847,7 @@
 				x, i := c.bigInt(0), c.uint(1)
 				if c.do() {
 					c.ret, c.err = func() (interface{}, error) {
-						if i > 1<<62 {
+						if i > math.MaxInt32 {
 							return 0, fmt.Errorf("bit index too large")
 						}
 						return x.Bit(int(i)), nil
diff --git a/pkg/math/bits/manual.go b/pkg/math/bits/manual.go
index 506d4f1..16350e2 100644
--- a/pkg/math/bits/manual.go
+++ b/pkg/math/bits/manual.go
@@ -20,6 +20,7 @@
 
 import (
 	"fmt"
+	"math"
 	"math/big"
 	"math/bits"
 )
@@ -40,7 +41,7 @@
 
 // At returns the value of the i'th bit of x.
 func At(x *big.Int, i uint) (uint, error) {
-	if i > 1<<62 {
+	if i > math.MaxInt32 {
 		return 0, fmt.Errorf("bit index too large")
 	}
 	return x.Bit(int(i)), nil