Created
May 2, 2016 18:02
-
-
Save jacktams/80dde5f2b03c9bd3f7ba805e29460068 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
function to8bitString(input){ | |
//clamp the value to 8-bits by and with 0xFF | |
var clampedValue = (input&0xFF).toString(2); | |
//pad the string to make it easier to read. | |
return String("00000000" + clampedValue).slice(-8); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment