Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

[GBDK] GAMEBOY [C]

Name: !MILKRIBS4k 2009-06-16 17:13

Anyone on here use the gameboy c compiler gbdk? http://gbdk.sourceforge.net/ There doesn't seem to be much documentation on it! Most of the code I find on google is designed for an older version of the compiler! How would I go about displaying a simple sprite! Someone help MILKRIBS4k!

Name: Anonymous 2009-06-18 2:10

>>34
I've argued against a number of these in the past.
To make this quick,
4. Swapping with exclusive-or (a^=b^=a^=b swaps a and b) is faster than using a temporary. This works for all types (including structures), but not on all compilers. Some compilers may also give you a harmless warning.
Reasons for avoidance in practice
Most modern compilers can optimize away the temporary variable in the naive swap, in which case the naive swap uses the same amount of memory and the same number of registers as the XOR swap and is at least as fast, and often faster. As a general rule, you should never use the XOR swap unless you know for a fact that the naive swap will not suit your application (which is very rare in this day and age). The XOR swap is also much less readable, and can be completely opaque to anyone who isn't already familiar with the technique.1
__________________
1. http://en.wikipedia.org/wiki/XOR_swap_algorithm#Reasons_for_avoidance_in_practice

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List