C/C++   |   Java   |   Oracle/Database   |   SAP   |   ASP .NET   |   Mainframe-DB2   |   Freshers
Add comment
Name:
Email:
* Comment:
(Use BBcode )


Check if the 20th bit of a 32 bit integer is on or off?

if((num & x00001000)==x00001000)

 

Note that the digits represented here are in hex.


0 0 0 0 1 0 0 0
^
|

x0000 0000 0000 0000 0001 0000 0000 0000 = 32 bits

^ ^ ^
| | |

0th bit 20th bit 32nd bit




RSS