Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
lostmsu
· 6y ago · 0 comments
I love the explanation, but why did the guy suggest a complicated bit work instead of just doing sum += arr[i] > 128 ? arr[i] : 0 is beyond me.
Comments
[–]
ncmncm
6y ago
That would not evoke the behavior he wanted to call attention to.
[–]
rabryan35
6y ago
Theres still a conditional branch in that statement
[–]
lostmsu
OP
6y ago
That depends on the compiler, and I'd expect most to optimize this into a cmov