Second implementation, bitwise operation