Re:SEPA: A Simple, Efficient Permutation Algorithm
by saagarjha on Sunday September 23, 2018 @08:42PM
(#18054229)
Most compilers will optimize this to whatever is faster even if you use the clearer version.
[ Parent
| on HN ]
Re:SEPA: A Simple, Efficient Permutation Algorithm
by and-then on Sunday September 23, 2018 @09:40PM
(#18054442)
You're making a sweeping, laughably-false assertion. Clearly you don't understand how compilers work. C compilers are not miraculous magic boxes. They have limited information and limited optimizations. It's very likely an obscure implementation of an algorithm will more-or-less translate one-to-one to nearly equivalent assembly because the compiler can't analyze it.
Re:SEPA: A Simple, Efficient Permutation Algorithm
by saagarjha on Sunday September 23, 2018 @09:47PM
(#18054470)
I think you've misrepresented what I said, which was that the compiler is good enough to pick between a register or XOR-swap (in the comment I was replying to), based on the architecture and calling sites.