You are viewing a single comment's thread. Return to all comments →
To do this in JavaScript, you need to end your operation with a Zero-fill right shift (>>>) so the result will be treated as an unsigned integer.
Not quite as straight-foward, but it should still be only be one line of code: ~n >>> 0.
Seems like cookies are disabled on this browser, please enable them to open this website
Flipping bits
You are viewing a single comment's thread. Return to all comments →
To do this in JavaScript, you need to end your operation with a Zero-fill right shift (>>>) so the result will be treated as an unsigned integer.
Not quite as straight-foward, but it should still be only be one line of code: ~n >>> 0.