|
|
|
|
|
by api
1878 days ago
|
|
I love me some branchless coding tricks. It's fun. My favorite is how you can multiply a bool by integers and use masking to conditionally set variables without branching. Just make sure that's defined behavior in your language. Casting bools to ints and bit shifting them can also be used to conditionally bit pack without branching. Lots of fun. (Might not be worth it if your architecture has conditional move instructions and your compiler is smart enough to use them.) |
|