Summary

You should now be familiar with six bitwise operators:

Works on bits for left argument, takes an integer as a second argument

bit_arg << shift_arg

Shifts bits to of bit_arg shift_arg places to the left -- equivalent to multiplication by 2^shift_arg

bit_arg >> shift_arg

Shifts bits to of bit_arg shift_arg places to the right -- equivalent to integer division by 2^shift_arg

Works on the bits of both arguments

left_arg &right_arg

Takes the bitwise AND of left_arg and right_arg

left_arg ^ right_arg

Takes the bitwise XOR of left_arg and right_arg

left_arg | right_arg

Works on the bits of only argument

~arg

Reverses the bits of arg

results matching ""

    No results matching ""