Mail Archives: djgpp/1999/08/26/20:00:31
Dan Gold wrote:
> I made an 1 dimensional array of a struct and made line pointers to the
> start of each row to make it like a 2 dimensional array. If I want to
> reference the line pointer as ->line[4][5], it will start on the row index
> 4, but will the 5 jump 5 tiles structs ahead as I allocated or just bytes.
> This is simalar to Allegro's bitmap line pointers which jump ahead bytes,
> but I am using structures not bytes.
If you declared it as a 'struct ... *' then it will jump in sizeof(struct)
bytes.
> If it does jump ahead structs for me, is there any speed concern when
> multiplying the address location 5 times by the size of the struct? [4th
> row] + [5 * sizeof TILE]
Multiplying by 5 is not difficult, and can be done in 1 instruction
without any explicit multiply. I don't remember the syntax. Don't worry
about it.
> One more thing. Does a struct pointer equal one 32bit address or an
> address for each member of the struct?
It is just 1 32-bit address.
--
-Rolf Campbell (39)3-6318
- Raw text -