Message-ID: <3597DAD1.A64738EA@compmore.net> Date: Mon, 29 Jun 1998 14:20:01 -0400 From: stdenis MIME-Version: 1.0 To: Arthur CC: DJGPP Mailing List Subject: Re: 64k demo References: <000301bda384$5fe81de0$364e08c3 AT arthur> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk > In almost any language, this is correct. It's faster to shift bits along a > byte than it is to multply, carry, check for overflows etc. It's much faster > to divide by using >> or SHR. Well you mean for most cpus not languages. In a AMD 686 a multiply is almost as fast a shift. (well except it doesn't pair) > I have noticed, though, that the PC only has one type of shifting command. > On the Motorola, there's ASL, ASR (arethmetic), LSL and LSR (logical), along > with the rolling commands ROL and ROR and all the shifting commands that > change different bits depending on the values entered into them. Are there > any of these on the PC? You can shift (on a 286) a byte or word or dword (386) any value, not just one. On a 8086 you must put the shift count in cl.... read a doc on 8086 for more. > And while we're on the subject, I am assuming that << and >> are arethmetic > shifting operands. Is there a similar command to do logical shifting in > C/C++? In C you use << SHL and >> SHR Read a doc on 8086 to find out. tom