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>
27 #ifndef _PDCLIB_CONFIG_H
28 #include <_PDCLIB_config.h>
34 result = lldiv( 5ll, 2ll );
35 TESTCASE( result.quot == 2 && result.rem == 1 );
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 TESTCASE( sizeof( result.quot ) == _PDCLIB_LLONG_BYTES );
41 TESTCASE( sizeof( result.rem ) == _PDCLIB_LLONG_BYTES );