5 /* ldiv( long int, long int )
7 This file is part of the Public Domain C Library (PDCLib).
8 Permission is granted to use, modify, and / or redistribute at will.
15 ldiv_t ldiv( long int numer, long int denom )
18 rc.quot = numer / denom;
19 rc.rem = numer % denom;
20 /* TODO: pre-C99 compilers might require modulus corrections */
27 #include <_PDCLIB_test.h>
29 #ifndef _PDCLIB_CONFIG_H
30 #include <_PDCLIB_config.h>
38 TESTCASE( div.quot == 2 && div.rem == 1 );
40 TESTCASE( div.quot == -2 && div.rem == -1 );
42 TESTCASE( div.quot == -2 && div.rem == 1 );
43 TESTCASE( sizeof( div.quot ) == _PDCLIB_LONG_BYTES );
44 TESTCASE( sizeof( div.rem ) == _PDCLIB_LONG_BYTES );