Address reprint: https://blog.csdn.net/bdss58/article/details/78388858
In C, there are some standard libraries limits.h defines a constant maximum and minimum values, for example an int constant INT_MAX maximum, minimum constant INT_MIN, unsigned integer type uint constant maximum UINT_MAX
golang standard library does not define these variables. However, bit manipulation operations can easily define these constants.
Uint Unsigned integer
whose minimum value is 0, all bits in its binary representation is 0,
const UINT_MIN uint = 0
All its maximum bit binary representation is 1, then,
const UINT_MAX = ^uint(0)
Signed integer int
The complement, its maximum binary representation, the first 0 and the other 1, then,
const INT_MAX = int(^uint(0) >> 1)
The complement, its minimum binary representation, the first one, the rest 0, then
const INT_MIN = ^INT_MAX