Timeline for Check whether an integer is a power of 2 without using +,- operations
Current License: CC BY-SA 3.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 5, 2014 at 12:24 | comment | added | orlp | @ProgramFOX But x&~(~0*x) still works. That's only 2 characters longer. | |
| Jan 4, 2014 at 15:29 | history | edited | null | CC BY-SA 3.0 | Remove "why question". |
| Jan 4, 2014 at 15:27 | comment | added | null | @ProgramFOX: I see. Interesting trick. | |
| Jan 4, 2014 at 15:21 | comment | added | user3094403 | The reason that + and - are forbidden for this challenge, is because if x & (x - 1) is equal to 0, then x is a power of 2. | |
| Jan 4, 2014 at 15:12 | history | answered | null | CC BY-SA 3.0 |