Mail Archives: djgpp/1996/07/11/16:01:43
In article <4rj0kb$sf3 AT nef DOT ens DOT fr>,
Pascal Massimino <massimin AT clipper DOT ens DOT fr> wrote:
>In article <4rh0g5$m9r AT twain DOT mo DOT net>, vecna AT Walden DOT mo DOT net ([vecna]) writes:
>|> I'm trying to write a simple putpixel to
>|> a 320x200 virtual screen, which is already allocated and defined as:
>|>
>|> char *virscr;
>|>
>|> This is my (yes, unoptimized) setpixel routine:
>|>
> movl _y,%eax
> imull $320,%eax
> addl _x,%eax
> movb _c,%cl
> addl _virscr,%eax
> movb %cl,(%eax)
how about....
lookup_table[y][x]=c;
where lookup_table is initialized at startup to...
char **lookup_table
for (i=0;i<200;i++) {
lookup_table[i]=virscr+i*320;
}
It's bound to be faster than an imull.
Eric
--
Eric Korpela | An object at rest can never be
korpela AT ssl DOT berkeley DOT edu | stopped.
<a href="http://www.cs.indiana.edu/finger/mofo.ssl.berkeley.edu/korpela/w">
Click here for more info.</a>
- Raw text -