P
puzzlecracker
#define BLACKBOX(x) ((x)&((x)-1))
#define BLACKBOX(x) ((x)&((x)-1))
puzzlecracker said:#define BLACKBOX(x) ((x)&((x)-1))
puzzlecracker said:#define BLACKBOX(x) ((x)&((x)-1))
puzzlecracker said:#define BLACKBOX(x) ((x)&((x)-1))
Yes!
BLACKBOX(x) return zero if and only if there is only one '1' in x, that is,
x is "power of 2"
puzzlecracker said:#define BLACKBOX(x) ((x)&((x)-1))
Now guess what this one does. If you can solve one, you can probably solve
the other, too.
puzzlecracker said:#define BLACKBOX(x) ((x)&((x)-1))
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.