delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/22/17:25:24

Message-ID: <376FF68F.326391E4@ameritech.net>
From: S Prasad <aangels AT ameritech DOT net>
X-Mailer: Mozilla 4.04 [en]C-AIT (Win95; I)
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Short pointers to Allegro Bitmaps?
Lines: 20
Date: Tue, 22 Jun 1999 16:48:15 -0400
NNTP-Posting-Host: 206.141.209.52
X-Trace: nntp0.detroit.mi.ameritech.net 930084985 206.141.209.52 (Tue, 22 Jun 1999 16:56:25 EDT)
NNTP-Posting-Date: Tue, 22 Jun 1999 16:56:25 EDT
Organization: Ameritech.Net www.ameritech.net Complaints: abuse AT ameritech DOT net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

This question is basically a C-programming question...
I have the following code in a program, which is set for 16-bit color:


BITMAP *OffScreen, *Texture;
... initialize these bitmaps ...

 short *SPtr;	                 //Short pointer to an offscreen bitmap
 SPtr = &((short*)OffScreen->line[Y])[X];  //Assign the pointer a value
					   //in the OffScreen BITMAP
				   

Now, in an inner loop, i have this code:

 *SPtr = ((short*)Texture->line[Y])[X];

Is there any way I can avoid casting to short* EACH time through the
loop?  For example, could I create a short* to Texture->line, and use
that through the loop?  Any help would be greatly appreciated!  Thanks
in advance...

- Raw text -


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