3 ms·
That returns true or false, which I believe strictly speaking aren't numeric in Javascript. By definition of problem, probably should be: function one_bit(x) {
by warmfuzzykitten 13y ago
That returns true or false, which I believe strictly speaking aren't numeric in Javascript. By definition of problem, probably should be:
function one_bit(x) {
return x & (x-1) == 0 ? 1 : 0;
}