[algorithm] Bitwise and in place of modulus operator