Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
GeertB
on June 10, 2024
|
parent
|
context
|
favorite
| on:
Compilers are too smart
A smart compiler would have used the test (x & (x - 1)) == 0 to verify that x (assumed non-zero) is a power of two. Don't know why Clang didn't do that here.
fooker
on June 10, 2024
[–]
The tricky part is doing this without knowing the value of x!
This is why compilers have to rely on static analysis.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: