Reputation: 83
How to get maximum int64 value using 2's complement arithmetic in golang
I need to compare incoming int64 value with maximum value for int64 (not using math package). I don't want to use math.MaxInt64 value, I know that where are some method for int
Upvotes: 0
Views: 268
Reputation: 83
Found: const MaxInt64 := int64(^uint64(0) >> 1) or const MaxInt64 = 1<<63 - 1, also const MaxUint = ^uint64(0)
Upvotes: 0