Bitwise Operator


These operators are used to perform manipulation of individual bits of a number. They can be used with any of the integer types. They are used when performing update and query operations of Binary indexed tree.

 

Operators                                                     Symbol                        Uses

Bitwise                                                             AND &                    op1 & op2

Bitwise exclusive                                            OR  ^                       op1 ^ op2

Bitwise inclusive                                             OR  |                         op1 | op2

Bitwise Compliment                                         ~                              ~ op

Bitwise left shift                                               <<                           op1 << op2

Bitwise right shift                                             >>                           op1 >> op2

Unsigned Right Shift Operator                   >>> op >>>                number of places to shift