JoeKarlsson/data-structures

View on GitHub
bitwise/README.md

Summary

Maintainability
Test Coverage
# BitWise

Bitwise AND a & b Returns a one in each bit position for which the corresponding bits of both operands are ones.
Bitwise OR  a | b Returns a one in each bit position for which the corresponding bits of either or both operands are ones.
Bitwise XOR a ^ b Returns a one in each bit position for which the corresponding bits of either but not both operands are ones.
Bitwise NOT ~ a Inverts the bits of its operand.
Left shift  a << b  Shifts a in binary representation b (< 32) bits to the left, shifting in zeroes from the right.
Sign-propagating right shift  a >> b  Shifts a in binary representation b (< 32) bits to the right, discarding bits shifted off.
Zero-fill right shift a >>> b Shifts a in binary representation b (< 32) bits to the right, discarding bits shifted off, and shifting in zeroes from the left.

- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#>>>_(Zero-fill_right_shift)
- http://michalbe.blogspot.com.br/2013/03/javascript-less-known-parts-bitwise.html
- http://jsperf.com/bitwise-vs-math-object
- http://united-coders.com/christian-harms/results-for-game-for-forfeits-and-the-winner-is/
- https://mudcu.be/journal/2011/11/bitwise-gems-and-other-optimizations/
- https://dreaminginjavascript.wordpress.com/2009/02/09/bitwise-byte-foolish/
- http://jsperf.com/math-min-max-vs-ternary-vs-if/24