Francesco Riosa wrote:
> And another one is (in inverse order for laziness):
>
> select
>   (8 & 1) AS `0`
> , (8 & 2 > 1) AS `1`
> , (8 & 4 > 1) AS `2`
> , (8 & 8 > 1) AS `3`
> , (8 & 16 > 1) AS `4`
> , (8 & 32 > 1) AS `5`
> , (8 & 64 > 1) AS `6`
> , (8 & 128 > 1) AS `7`
> ;
>   
but this one looks better:

select
  (8 & 1) AS `0`
, (8 >> 1 & 1) AS `1`
, (8 >> 2 & 1) AS `2`
, (8 >> 3 & 1) AS `3`
, (8 >> 4 & 1) AS `4`
, (8 >> 5 & 1) AS `5`
, (8 >> 6 & 1) AS `6`
, (8 >> 7 & 1) AS `7`
;

http://dev.mysql.com/doc/refman/4.1/en/bit-functions.html



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to