home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!mcsun!Germany.EU.net!news.Hamburg.Germany.EU.net!jwminhh!wieck
- From: wieck@jwminhh.hanse.de (Jan Wieck)
- Subject: Re: How to do an efficient ROTATE in C?
- Message-ID: <1992Dec17.062842.11116@jwminhh.hanse.de>
- Organization: Private Site under Mach386
- X-Newsreader: Tin 1.1 PL4
- References: <1992Dec16.090322.10452@thunder.mcrcim.mcgill.edu>
- Date: Thu, 17 Dec 1992 06:28:42 GMT
- Lines: 30
-
- mouse@thunder.mcrcim.mcgill.edu (der Mouse) writes:
- : > Distribution: ba
- :
- : Someone's leaking ba...
- :
- : In article <71576@cup.portal.com>, Aurelius@cup.portal.com (Mark Christian Barnes) writes:
- :
- : > Most C compilers will do rotates, i.e. logical shifts,
- :
- : As I understand and use the terms, a rotate and a logical shift are not
- : at all the same thing. As I use the terms, given a 16-bit datum
- : holding 0x74a0, a logical shift left by 4 bits would produce 0x4a00,
- : while a rotate left by 4 bits would produce 0x4a07.
-
- This is the equivalence to the functionality of a ROL-assembly-instruction
- for an 8086. Most microprocessors (from the 4-bit days up to today) have
- two kind's of rotate-functions. One of the above functionality, and one
- where the bits are shifted through the carryflag. In that case your result
- may be 0x4a03 or 0x4a0b, depending on the previous state of the carryflag.
- The carryflag is set after the operation. This is the functionality of a
- RCL-instruction for an 8086.
-
-
- Until later, Jan
-
- --
- # Any language keeps its own misunderstandings; #
- # why shouldn't programming languages do? #
- # #
- # wieck@jwminhh.hanse.de (Jan Wieck) #
-