home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / c / 18544 < prev    next >
Encoding:
Text File  |  1992-12-17  |  1.6 KB  |  42 lines

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