Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

The bitwise operations operate on the binary level of a value instead of the value itself. Said otherwise, the bitwise operators act on the individual bits that compose a value. To understand how they work, we must first look at the binary representation of integers. We will then show what the available bitwise operators and how to use them.

Bitwise operators are listed in Table 1.

Table 1:Bitwise operators

Operator

Description

!

Bitwise complement

&

Bitwise AND

|

Bitwise OR

^

Bitwise XOR

<<

Left Shift

>>

Right Shift [1]

Footnotes
  1. Arithmetic right shift on signed integer types, logical right shift on unsigned integer types.