Message-Id: Comments: Authenticated sender is From: "Salvador Eduardo Tropea (SET)" Organization: INTI To: "Arthur" , djgpp AT delorie DOT com Date: Mon, 29 Jun 1998 16:54:24 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: 64k demo In-reply-to: <008b01bda38e$369d3d80$364e08c3@arthur> Precedence: bulk "Arthur" wrote: > >In C you use << SHL and >> SHR > > You don't seem to understand what I mean. There is a fundamental difference > between arethmetic and logical shifting. Arethmetic shifting shifts the data > (bytes, words or longs) but keeps the sign bit intact. Logical shifting > treats the sign bit as any other bit in the byte/word/long. SHR/SHL are logical shift SAL/SAR are arithmetic (Shift Arithmetic Left) > So for instance, aretmetically shifting left the value -2 would give the > result -4; logically shifting left -2 would give 4. > > Rolling takes any bits shifted off one end of the byte/word/long and sticks > them on the other end. ROR/ROL > So rolling a byte right (logically) with the value of 1 would give the > answer of 65664. > > The shift commands which change different bits that I was referring to are > commands like "shift with carry" and "shift with overflow." > > AFAIK, you can only do arethmetic shifting in C, like I said. No! if you apply >> and << to an unsigned you get logical stuff. The arithmetic is used only for signeds. SET ------------------------------------ 0 -------------------------------- Visit my home page: http://set-soft.home.ml.org/ or http://www.geocities.com/SiliconValley/Vista/6552/ Salvador Eduardo Tropea (SET). (Electronics Engineer) Alternative e-mail: set-soft AT usa DOT net set AT computer DOT org ICQ: 2951574 Address: Curapaligue 2124, Caseros, 3 de Febrero Buenos Aires, (1678), ARGENTINA TE: +(541) 759 0013