top | item 44000615

(no title)

mmozeiko | 9 months ago

If you change logic and/or to bitwise and/or then it'll be branchless.

discuss

order

kragen|9 months ago

True: https://godbolt.org/#g:!((g:!((g:!((h:codeEditor,i:(filename... but I understood hoten to be saying that compilers would generally produce that version from the short-circuiting version, and they don't.

hoten|9 months ago

Yeah I was wrong.

Do we know why the compiler doesn't do it? Surely the output is the same and avoiding branches is clearly faster.

Maybe short circuiting requires such an optimization not be made?