This is my test function.
if -1 != cmp(2<<32, keys[2].Distance(keys[5])) {
t.Errorf("2<<32 should be smaller")
}
it results in the folllowing error
constant 8589934592 overflows int
Is it possible to make this work on a 32 bit system?
edit: also this is the Distance function for comparing keys
// Distance returns the distance metric in this key space
func (s *xorKeySpace) Distance(k1, k2 Key) *big.Int {
// XOR the keys
k3 := XOR(k1.Bytes, k2.Bytes)
// interpret it as an integer
dist := big.NewInt(0).SetBytes(k3)
return dist
}
Make sure you work on an 64bit int, the best way is to ensure the size by using uint64
type Key int64 // or uint64
Assuming key is defined to be int, otherwise just change all your function signatures from int
to int64
.