- Joined
- Nov 26, 2006
- Messages
- 11,136
the best part of them is that:
Code:x = x + 1; turns into: mov eax, _x add eax, 1 mov _x, eax while x++; turns into: mov eax, _x inc eax mov _x, eax
and the opcode 'inc' is WAY faster than 'add', making them ideal for loops. Specially since Galaxy is JIT compiled; no much optimization is done while the game compiles it.
In other words, it improves performance.
Um no, a good compiler will find the +/- 1's and change those into inc and dec. Similar thing with *2 and /2: it'll change them to bit shifts.
Then again this is blizzard we're talking about, not some big language >___>