Bitwise Operators is an actively used design pattern. 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...
- Bitwise Operators ranks in the top 25% of entities I track
- the Bitwise Operators wikipedia page
- Have a question about Bitwise Operators not answered here? Email me and let me know how I can help.
- Read more about Bitwise Operators
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 */
var x = 5 & 1;
Example from python:
x << y
Example from r:
! x x & y x && y x | y x || y xor(x, y)
Last updated January 28th, 2020