First implementation, bitwise operation