Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
flyingcircus3
on March 4, 2023
|
parent
|
context
|
favorite
| on:
Demystifying bitwise operations, a gentle C tutori...
For the first puzzle, code that determines if a value has one bit high, without any if/while/for, here's what I got:
!(x & (x-1)) && x
Was there a "best" solution somewhere? I couldnt get the code window to work.
amenghra
on March 5, 2023
[–]
-1 is not an allowed operator in my puzzle.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
!(x & (x-1)) && x
Was there a "best" solution somewhere? I couldnt get the code window to work.