Mail Archives: djgpp/1996/11/27/18:23:26
Glen Miner wrote:
> How well will djgpp deal with two dimentional arrays? Say I'm stepping
> through char MyArray[9][9] like so:
>
> for (x = 0; x < 6; x++)
> for (y = 0; y < 7; y++)
> MyArray [x][y] = SomeValue;
>
> Will it be smart and index it by a pointer so that it doesn't have to
> recalculate the address every time?
Actually, gcc will do one better and either get the hardware to
calculate the offsets in 1 or 2 instructions (=2/4clocks on 386,1/2 on
486(?)) or, because all bounds are constants, do some realy niffty
indexing. Try using loop unrolling which is NOT done by default
(--funroll-loops I think, you will need to verify that), this is a
perfect candidate for the above.
BTW you should see what it does to (val is unsigned long)
x=(val<<3)|(val>>29)! 2.2.2 did anyway, I'll have to check if 2.7.2.1
does the same thing (hint, 1 intruction!).
Bill
--
Leave others their otherness.
- Raw text -