home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 1.ddi / CLIBSRC1.ZIP / DIVT.CAS < prev    next >
Encoding:
Text File  |  1992-06-10  |  1.2 KB  |  47 lines

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