-
-
Save joa/7446637 to your computer and use it in GitHub Desktop.
This file contains 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
static int[] t = {0, 5, 1, 6, 4, 3, 2, 7}; | |
int foo(final byte value) { | |
int x = value & 0xff; | |
x |= x >> 1; | |
x |= x >> 2; | |
x |= x >> 4; | |
x *= 0x1d; | |
x &= 0xff; | |
x >>= 5; | |
return t[x]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment