2 ms·
Right, but the same is true of signed as well.
by detrino 13y ago
Right, but the same is true of signed as well.
- DannyBee 13y agoThe issue i raised is that you replaced a perfectly functioning loop with one that does not work properly (it does iterate the same number of times for all inputs) You said "I can change <= n to != n + 1". You cannot. for n == UNSIGNED_MAX, the former loop will iterate infinitely, the latter loop will never iterate. Both are well defined to occur. You cannot change the loop behavior and say you have the same loop :)
- detrino 13y agoI never meant to imply that changing "<= n" to "!= n + 1" does not change the semantics of the unsigned loop. This was an example shown in some LLVM documentation as to why you should use signed loop variables. I was just showing that you can still use unsigned variables, have the same semantics as _the signed loop_ ,and get vectorized code.