PHPz2017-04-17 15:25:27
7 = 00000111b
& is bitwise AND
so the x&7 has the only 3 low bits of x.
~7 = 11111000b
so the x&~7 will set x's 3 low bits to 0, and it is the multiple of 8.
(x+n-1)&(n-1)
, increase x slightly larger than a multiple of n of x, provided that n must be 2^m
because only 2^m-1
has the type: high bits must be 1, low bits must be 0 , not intersected.
subnet mask subnet mask