PLDB
Languages Features Calendar About Lists Add Language
GitHub icon

Bitwise Operators

Bitwise Operators

Bitwise Operators are a language feature.

In digital computer programming, a bitwise operation operates on one or more bit patterns or binary numerals at the level of their individual bits. It is a fast and simple action, directly supported by the processor, and is used to manipulate values for comparisons and calculations. On simple low-cost processors, typically, bitwise operations are substantially faster than division, several times faster than multiplication, and sometimes significantly faster than addition. Read more on Wikipedia...

Languages with Bitwise Operators include JavaScript, C, Python, C++, R

Example from JavaScript:

var x = 5 & 1;

Example from C:

int i = 4; /* bit pattern equivalent is binary 100 */ int j = i << 2; /* makes it binary 10000, which multiplies the original number by 4 i.e. 16 */

Example from Python:

x << y

Example from R:

! x x & y x && y x | y x || y xor(x, y)

Article source

PLDB - Build the next great programming language. v5.0.0 - Acknowledgements · Email · GitHub