From: Paul Shirley Newsgroups: comp.os.msdos.djgpp Subject: Re: graphics Date: Sun, 29 Dec 1996 18:31:20 +0000 Organization: wot? me? Lines: 27 Distribution: world Message-ID: References: <1 DOT 5 DOT 4 DOT 16 DOT 19961218230509 DOT 19f7ab66 AT mail DOT algonet DOT se> <32c3e184 DOT 1226804 AT news DOT eunet DOT fi> <01bbf50f$5ce75680$d42649c2 AT default> Reply-To: Paul Shirley NNTP-Posting-Host: chocolat.foobar.co.uk Mime-Version: 1.0 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp In article <01bbf50f$5ce75680$d42649c2 AT default>, Thomas Harte writes >> Then draw pixels in this way: >> #include >> #include >> _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