GNU Info

Info Node: (mysql.info)Bit functions

(mysql.info)Bit functions


Next: Miscellaneous functions Prev: Other Functions Up: Other Functions
Enter node , (file) or (file)node

Bit Functions
.............

MySQL uses `BIGINT' (64-bit) arithmetic for bit operations, so these
operators have a maximum range of 64 bits.

`|'
     Bitwise OR:
          mysql> select 29 | 15;
                  -> 31

`&'
     Bitwise AND:
          mysql> select 29 & 15;
                  -> 13

`<<'
     Shifts a longlong (`BIGINT') number to the left:
          mysql> select 1 << 2;
                  -> 4

`>>'
     Shifts a longlong (`BIGINT') number to the right:
          mysql> select 4 >> 2;
                  -> 1

`~'
     Invert all bits:
          mysql> select 5 & ~1;
                  -> 4

`BIT_COUNT(N)'
     Returns the number of bits that are set in the argument `N':
          mysql> select BIT_COUNT(29);
                  -> 4


automatically generated by info2www version 1.2.2.9