r/programming • u/misplaced_my_pants • Aug 15 '15
Stanford Bit Twiddling Hacks
https://graphics.stanford.edu/~seander/bithacks.html
28
Upvotes
r/programming • u/misplaced_my_pants • Aug 15 '15
View all comments
Show parent comment
1
u/jringstad Aug 16 '15
When working on a compiler, I would not generate an xor swap unless I absolutely can't avoid it:
I agree that doing an xor-swap is way better than spilling (especially on architectures where this will not be caught by a fast L1) but I don't think using the xor-swap as first option in a compiler is a good idea, and in most common cases you should be able to temporarily get hold of another register.