There are 7 bitwise operators, &, |, ^, ~, >>, <<, and >>>.
These operators convert their operands to integers (truncating any floating point towards 0), and perform the specified bitwise operation on them. The logical bitwise operators, &, |, and ^, perform the and, or, and xor on each individual bit and provides the return value. The ~ inverts all bits within an integer, and usually appears in combination with the logical bitwise operators.
Two bit shift operators, >>, <<, move the bits in one direction which has a similar effect to multiplying or dividing by a power of two. The final bit-shift operator, >>>, operates the same way, but does not preserve the sign bit when shifting.
Posted by admin
on December 28 2009 16:12:15
||2888 Reads ·