2 ms·
These slides on Bit Hacks are interesting too if you're looking for a more verbose presentation on some of these: https://ocw.mit.edu/courses/electrical-engine
by jrib 6y ago
These slides on Bit Hacks are interesting too if you're looking for a more verbose presentation on some of these:
https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-172-performance-engineering-of-software-systems-fall-2018/lecture-slides/MIT6_172F18_lec3.pdf https://ocw.mit.edu/courses/electrical-engineering-and-compu...
Also, curiously enough, I was on the page in the submission after a co-worker asked yesterday if there was a cleaner way to do:
return direction === 'asc' ? value : -value;
Was fun to work through how https://graphics.stanford.edu/~seander/bithacks.html#ConditionalNegate https://graphics.stanford.edu/~seander/bithacks.html#Conditi... works. (no, we didn't change our javascript code to use the bit hack)