Example: Bitwise operators

For these examples tag_1 = 5 (binary 0000 0000 0000 0101), tag_2 = 3 (binary 0000 0000 0000 0011)
tag_1 & tag_2
returns 1 (binary 0000 0000 0000 0001)
tag_1 | tag_2
returns 7 (binary 0000 0000 0000 0111)
tag_1 ^ tag_2
returns 6 (binary 0000 0000 0000 0110)
tag_1 >> 1
returns 2 (binary 0000 0000 0000 0010)
tag_ << 1
returns 10 (binary 0000 0000 0000 1010)
~ tag_1
returns -6 (binary 1111 1111 1111 1010)
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal