Last active
October 10, 2016 10:29
-
-
Save akadrac/29c263ab8d518b953f4e770aa39b987e to your computer and use it in GitHub Desktop.
Swap Adjacent Bits
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function swapAdjacentBits(n) { | |
| return (((n & 0b101010101010101010101010101010) >> 1) | ((n & 0b010101010101010101010101010101) << 1)) ; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment