home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c065 / 2.ddi / CLIB2.ZIP / ROTR.CAS < prev    next >
Encoding:
Text File  |  1990-06-07  |  1.5 KB  |  45 lines

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