Y
Hacker News
new
|
ask
|
show
|
jobs
by
GeertB
732 days ago
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.
1 comments
fooker
732 days ago
The tricky part is doing this without knowing the value of x!
This is why compilers have to rely on static analysis.
link
This is why compilers have to rely on static analysis.