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

  1. /*---------------------------------------------------------------------------
  2.  * filename - divt.cas
  3.  *
  4.  * function(s)
  5.  *         div - integer division
  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 <asmrules.h>
  20. #include <stdlib.h>
  21.  
  22.  
  23. /*--------------------------------------------------------------------------*
  24.  
  25. Name            div - integer division
  26.  
  27. Usage           div_t div(int numer, int denom);
  28.  
  29. Prototype in    stdlib.h
  30.  
  31. Description     div computes the quotient and  remainder of the division of
  32.                 the numerator  "numer" by the  denominator "denom". If  the
  33.                 result cannot be represented, the behavior is undefined.
  34.  
  35. Return value    div returns a structure of  type div_t, comprising both the
  36.                 quotient and the remainder.
  37.  
  38. /*--------------------------------------------------------------------------*/
  39. #pragma warn -rvl
  40. div_t   div(int numer, int denom)
  41. {
  42. asm     mov     ax, numer
  43. asm     cwd
  44. asm     idiv    W0(denom)
  45. }
  46. #pragma warn .rvl
  47.  
  48.