Gunakan tanda [] untuk mencari tag gan! contoh [flutter, javascript]

Pemrograman Dasar Dart
Pemrograman Dasar Dart

Bab 4

Operator Bitwise

remove_red_eye 2095 Kali
spellcheck 666 Kata, 1655 Karakter

Bitwise is a designated 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 find out, maybe it can be your shortcut in getting things done

Cheat Sheet


Operators Description
&

AND

example:

a & b

Returns one at each bit position where the corresponding bit 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 one but not both operands is one.

~

NOT

example:

~a

Inverts the operand bits.

<<

Left Shift

a << b

Shifts a in binary representation b (<32) bits to the left, shifts zeros from the right.

>>

Sign propagating right shift

a >> b

Shifting a in binary representation b(<32) bits to the right, the discarded bit shifts.


Example of Use

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



Artikel Selanjutnya (Assignment Operator)
Navigasi Konten