home *** CD-ROM | disk | FTP | other *** search
- /*---------------------------------------------------------------------------
- * filename - divt.cas
- *
- * function(s)
- * div - integer division
- *--------------------------------------------------------------------------*/
-
- /*[]------------------------------------------------------------[]*/
- /*| |*/
- /*| Turbo C Run Time Library - Version 3.0 |*/
- /*| |*/
- /*| |*/
- /*| Copyright (c) 1987,1988,1990 by Borland International |*/
- /*| All Rights Reserved. |*/
- /*| |*/
- /*[]------------------------------------------------------------[]*/
-
- #pragma inline
- #include <asmrules.h>
- #include <stdlib.h>
-
-
- /*--------------------------------------------------------------------------*
-
- Name div - integer division
-
- Usage div_t div(int numer, int denom);
-
- Prototype in stdlib.h
-
- Description div computes the quotient and remainder of the division of
- the numerator "numer" by the denominator "denom". If the
- result cannot be represented, the behavior is undefined.
-
- Return value div returns a structure of type div_t, comprising both the
- quotient and the remainder.
-
- /*--------------------------------------------------------------------------*/
- #pragma warn -rvl
- div_t div(int numer, int denom)
- {
- asm mov ax, numer
- asm cwd
- asm idiv W0(denom)
- }
- #pragma warn .rvl
-
-