guard the private header
[reactos.git] / reactos / lib / crtdll / old cruft / stdlib / lldiv.c
1 /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
2 /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
3 #include <msvcrt/stdlib.h>
4
5 lldiv_t
6 lldiv(long long num, long long denom)
7 {
8 lldiv_t r;
9
10 if (num > 0 && denom < 0)
11 {
12 num = -num;
13 denom = -denom;
14 }
15 r.quot = num / denom;
16 r.rem = num % denom;
17 if (num < 0 && denom > 0)
18 {
19 if (r.rem > 0)
20 {
21 r.quot++;
22 r.rem -= denom;
23 }
24 }
25 return r;
26 }