www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/01/09:21:43

From: mvparvia AT delta DOT hut DOT fi (Mikko V.I. Parviainen)
Newsgroups: comp.os.msdos.djgpp
Subject: Allegro, pointers : how do I get line from BITMAP?
Date: 1 Jan 99 10:35:26 GMT
Organization: Helsinki University of Technology, CS lab
Lines: 45
Distribution: world
Message-ID: <mvparvia.915186926@snakemail.hut.fi>
NNTP-Posting-Host: delta.hut.fi
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi!

I have a problem. I wrote a game of life during Christmas
holidays. It is a bit slow, so I have been thinking of
ways to optimize it.

Currently it holds the world as a BITMAP struct, and
uses BITMAP's line-field to access the points.
(Definition of line : 
  
  struct BITMAP {
    ....
    unsigned char *line[0];
  }

)

Now, the routine which checks the number of live adjacent
cells of all cells is passed a BITMAP *, and
it checks the adjacent cells with expressions like (BITMAP *b)  

  b->line[y][x]

Functions well. However, the eight indirections (?) of b
for every cell do add significant overhead, so I tried to
use an alias for b->line, but could not define the 
variable.

In other words, I am trying to define a variable so that
I could say
 
  temp[y][x]     to access      b->line[y][x]

but cannot find the right expression for temp.

If you could point me to the right declaration (or some
other solution), I would be mostly thankful.    

I have been experimenting with 1024x768 worlds, which 
are slow on my P200. 
-- 
--
Mikko Parviainen
 IMTU tc+ tm++ tn+ ru+ ge++ 3i+ jt-- jd++ pi au st- ls kk hi++ dr++ as+
va+ so- zh+ da++ 

- Raw text -


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