www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/26/20:00:31

Sender: "Rolf Campbell" <cp1v45 AT nortelnetworks DOT com>
Message-ID: <37C556A2.C1A89379@NortelNetworks.com>
Date: Thu, 26 Aug 1999 11:00:51 -0400
From: "Rolf Campbell" <cp1v45 AT nortelnetworks DOT com>
Organization: Nortel Networks
X-Mailer: Mozilla 4.7 [en] (X11; I; HP-UX B.10.20 9000/712)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
To: djgpp AT delorie DOT com
Subject: Re: Struct Array Allocation, Line Pointers, Automatic Offseting?
References: <199908260412 DOT AAA09411 AT delorie DOT com>
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019