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

  1. /*-----------------------------------------------------------------------*
  2.  * filename - rotl.cas
  3.  *
  4.  * function(s)
  5.  *        _rotl - rotates an unsigned integer left
  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            _rotl - rotates an unsigned integer left
  25.  
  26. Usage        unsigned _rotl(unsigned val, int rotate_count)
  27.  
  28. Prototype in    stdlib.h
  29.  
  30. Description     _rotl rotates the unsigned integer val left rotate_count
  31.          bits.
  32.  
  33. Return value   the unsigned integer val after rotation
  34.  
  35. *------------------------------------------------------------------------*/
  36.  
  37. #undef _rotl               /* not an intrinsic */
  38. unsigned _rotl(unsigned val, int rotate_count)
  39. {
  40. asm    mov    ax, val
  41. asm    mov    cx, rotate_count
  42. asm    rol    ax, cl
  43.     return    _AX;
  44. }
  45.