I need a way (preferably fast) to turn very larger numbers into an array of bits. I tried sprintf and then splitting, but it looks like sprintf can't do a binary print of numbers that large (up to 1<<80) - nor am I confident that was a really "speedy" way to approach the issue. It seems like there should be some easy way to do this.
Essentially if I start with the number 57, I want to end up with the array ( 1, 0, 0, 1, 1, 1 ) (low bit is the first element).
Alternatively, if I just had a good way of checking the xth bit of a number without building a bitmask (unless someone can clue me in on how to do that quickly) that would work.
Speed matters to me because I've got a lot of computations to run here and if I burn too many cycles the program will end up taking an impractical amount of time (months) to run.
In reply to Turning very larger numbers into an array of bits by gblack
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |