Use [] to find tag! Example: [flutter, javascript]

Dart Basic Programming
Dart Basic Programming

Chapter 4

Bitwise Operators

remove_red_eye 2092 Times
spellcheck 141 Words, 887 Characters

Bitwise is a designating operator in a programming language that manipulates the individual bits in a byte or word. This is very rarely used in programming, but if you can figure it out, maybe it can be your shortcut in getting something done

Cheat Sheet


OperatorDescription
&

AND

example:

a & b

Returns one at each bit position where the bit The corresponding value of both operands is one.

|

OR

example:

a | b

Returns one at each bit position where the corresponding bit of either or both operands is one.

^

XOR

example:

a ^ b

Returns one at each bit position where the corresponding bit of is false one but not both operands are one.

~

NOT

example:

~a

Inverts the bits of the operand.

Left Shift

a

Shifts a in binary representation b (

>>

Signpropagating right shift

a >> b

Shift a in binary representation b (


Example of Use

if the snippet below doesn't work, please open this snippet



Next Article (Assignment Operator)
Content Navigation