### Bitwise Operators in Trillium

Bitwise operators are based on the principle of performing operations bit by bit which is based on boolean algebra. It increases the processing speed and hence the efficiency of the program.

The Bitwise Operators in Trillium are the following:

- & (Bitwise AND) – Converts the value of both the operands into binary form and performs AND operation bit by bit.
- | (Bitwise OR) – Converts the value of both the operands into binary form and performs OR operation bit by bit.
- ^ (Bitwise exclusive OR) – Converts the value of both the operands into binary form and performs EXCLUSIVE OR operation bit by bit.

### Bitwise Operators Explained

In order to better understand bitwise operators, lets refer to the truth table for various bitwise operations and understand how it is associated with boolean algebra.

Lets take 2 variables, named, a and b.

AND – Both the operands need to have boolean value 1 for the result to be 1.

OR – At least one operand should have boolean value 1 for the result to be 1.

XOR (EXCLUSIVE OR) – Either the first operand should have boolean value 1 or the second operand should have boolean value 1. Both cannot have the boolean value 1 at the same time however.

### Some Basic Bitwise Statements

Below you will see more examples of bitwise operators in use. .