2008-12-02

Iterators and Bugfixes

Something I’ve been meaning to do for a while is replace any non-int iterator variables with ints. This was mentioned nearly a year ago by a chap called cearn, whose website I’ve been browsing through lately. In addition to his advice, I’ve spotted the same information in the documentation for the official ARM C compiler. That book was written for the ARM4, so it’s probably ancient now and not entirely appropriate to GCC, but it does re- iterate the same information:

Use ints.

Variables that aren’t 32 bits wide need to be masked out to be read correctly, and in the case of the ARM compiler, using non-int typed variables as loop iterators could result in massive amounts of extra assembly being produced.

I’ve gone through all of the iterators in the main Woopsi codebase (still need to do the bonus folder) and swapped all of the iterators to u32s (or s32s, as appropriate). As a side effect, this should fix any remaining problems that could arise from complex layouts (too many child gadgets) or complex display splits (too many rects for the u8 to represent).

Secondly, I’ve fixed a bug reported by Azaydius on the forum. The ScrollingListBox wasn’t passing calls to setAllowMultipleSelections() to its ListData object.