From: sparhawk AT eunet DOT at (Gerhard Gruber) Newsgroups: comp.os.msdos.djgpp Subject: Re: 64k demo Date: Mon, 29 Jun 1998 21:26:01 GMT Organization: Customer of EUnet Austria Lines: 33 Message-ID: <359de1a2.2452727@news.Austria.EU.net> References: <000301bda384$5fe81de0$364e08c3 AT arthur> NNTP-Posting-Host: e051.dynamic.vienna.at.eu.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Destination: "Arthur" From: Gruber Gerhard Group: comp.os.msdos.djgpp Date: Mon, 29 Jun 1998 14:00:31 +0100: >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. > >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? > >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++? This is rather machine dependent. Don't know how this is on the PC, but on my Amiga it depended on the type of the variable you used. I'm not sure which on were really used but when you declared "unsigned int" then the >> used ASL and with "signed int" it used LSL (or vice versa, I'm not sure exactly anymore about this). 80x86 has also a logical and an arithmetic shift and I guess that compilers use this as well. -- Bye, Gerhard email: sparhawk AT eunet DOT at g DOT gruber AT sis DOT co DOT at Spelling corrections are appreciated.