5 /* lldiv( long long int, long 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 lldiv_t lldiv( long long int numer, long 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>
36 result = lldiv( 5ll, 2ll );
37 TESTCASE( result.quot == 2 && result.rem == 1 );
38 result = lldiv( -5ll, 2ll );
39 TESTCASE( result.quot == -2 && result.rem == -1 );
40 result = lldiv( 5ll, -2ll );
41 TESTCASE( result.quot == -2 && result.rem == 1 );
42 TESTCASE( sizeof( result.quot ) == _PDCLIB_LLONG_BYTES );
43 TESTCASE( sizeof( result.rem ) == _PDCLIB_LLONG_BYTES );