home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 1.ddi / CLIBSRC.ZIP / ROTR.CAS < prev    next >
Encoding:
Text File  |  1992-06-10  |  1.1 KB  |  44 lines

  1. /*-----------------------------------------------------------------------*
  2.  * filename - rotr.cas
  3.  *
  4.  * function(s)
  5.  *        _rotr - rotates an unsigned integer right
  6.  *-----------------------------------------------------------------------*/
  7.  
  8. /*
  9.  *      C/C++ Run Time Library - Version 5.0
  10.  *
  11.  *      Copyright (c) 1987, 1992 by Borland International
  12.  *      All Rights Reserved.
  13.  *
  14.  */
  15.  
  16.  
  17. #pragma inline
  18. #include <stdlib.h>
  19.  
  20.  
  21. /*-----------------------------------------------------------------------*
  22.  
  23. Name            _rotr - rotates an unsigned integer right
  24.  
  25. Usage           unsigned _rotr(unsigned val, int rotate_count)
  26.  
  27. Prototype in    stdlib.h
  28.  
  29. Description     _rotr rotates the unsigned integer val right rotate_count
  30.                 bits.
  31.  
  32. Return value   the unsigned integer val after rotation
  33.  
  34. *------------------------------------------------------------------------*/
  35.  
  36. #undef _rotr               /* not an intrinsic */
  37. unsigned _rotr(unsigned val, int rotate_count)
  38. {
  39. asm        mov   ax, val
  40. asm        mov   cx, rotate_count
  41. asm        ror   ax, cl
  42.            return        _AX;
  43. }
  44.