Bitwise NOT

  • Thread starter Thread starter Aamir Mahmood
  • Start date Start date
A

Aamir Mahmood

hi
how can i perform a bitwise NOT on a int or long or uint type variable?
so that the bits should be inverted in the result.

-
aamir
 
Aamir Mahmood said:
how can i perform a bitwise NOT on a int or long or uint type variable?
so that the bits should be inverted in the result.

~ is the bitwise not operator. For instance:

uint x = 0x1234;
uint y = ~x;

y is now 0xffffedcb
 
Back
Top