4 ms·
Oh, come on, you don't need a branch to do a conditional subtraction. Reify the condition to 0/1 and use multiplication, or use AND with a two's complement of
by pklausler 10y ago
Oh, come on, you don't need a branch to do a conditional subtraction. Reify the condition to 0/1 and use multiplication, or use AND with a two's complement of the condition.
- dllthomas 10y agoGood point!
- avocad 10y agoThanks! This AND trick is great. Actually makes me want to go back to assembly-level programming.
- cksk 10y agoOK, my bit twiddling knowledge is weak, my google skills are weaker still, and now I'm curious: what does "AND with a two's complement of the condition" mean, exactly?