3 /* lldiv( long long int, long long int )
5 This file is part of the Public Domain C Library (PDCLib).
6 Permission is granted to use, modify, and / or redistribute at will.
13 lldiv_t lldiv( long long int numer, long long int denom )
16 rc.quot = numer / denom;
17 rc.rem = numer % denom;
18 /* TODO: pre-C99 compilers might require modulus corrections */
25 #include <_PDCLIB_test.h>
30 result = lldiv( 5ll, 2ll );
31 TESTCASE( result.quot == 2 && result.rem == 1 );
32 result = lldiv( -5ll, 2ll );
33 TESTCASE( result.quot == -2 && result.rem == -1 );
34 result = lldiv( 5ll, -2ll );
35 TESTCASE( result.quot == -2 && result.rem == 1 );
36 TESTCASE( sizeof( result.quot ) == sizeof( long long ) );
37 TESTCASE( sizeof( result.rem ) == sizeof( long long ) );