Comment Comment by maplet You can actually generalize i % 2 == i & 1 to larger powers of 2.Using C Syntax,i % (1 << n) == i & ((1 << n) - 1)holds for unsigned integer n and (1 << n) is 2 to the power of n. parent maplet 1 year ago
Using C Syntax,
i % (1 << n) == i & ((1 << n) - 1)
holds for unsigned integer n and (1 << n) is 2 to the power of n.