Mail Archives: djgpp/1996/12/29/14:40:22
In article <01bbf50f$5ce75680$d42649c2 AT default>, Thomas Harte
<T DOT Harte AT btinternet DOT com> writes
>> Then draw pixels in this way:
>> #include<go32.h>
>> #include<sys/farptr.h>
>> _farpokeb(_dos_ds, 0xA0000+y*320+x, color);
>
> Instead of multiplying by 320, I suggest you use two bit-shifts,
>therefore
>changing the line to :-
>
> _farpokeb(_dos_ds, 0xA0000 + (y << 8) + (y << 6) + x, colour);
>
> . . . .as this is faster.
>
> -Thomas
I suggest you leave it as *320, gcc will generate optimal code itself.
You will also be better able to read the source ;)
(It probably compiles faster as well... last time I looked the explicit
shift version got converted to the same code as a plain multiply. Its
probably a lot easier to detect a explicit multiply than the implied
one.)
---
Paul Shirley: shuffle chocolat before foobar for my real email address
- Raw text -