git://git.jankratochvil.net
/
reactos.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[reactos.git]
/
lib
/
msvcrt
/
stdlib
/
ldiv.c
1
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
2
#include <msvcrt/stdlib.h>
3
4
ldiv_t
5
ldiv(long num, long denom)
6
{
7
ldiv_t r;
8
9
if (num > 0 && denom < 0)
10
{
11
num = -num;
12
denom = -denom;
13
}
14
r.quot = num / denom;
15
r.rem = num % denom;
16
if (num < 0 && denom > 0)
17
{
18
if (r.rem > 0)
19
{
20
r.quot++;
21
r.rem -= denom;
22
}
23
}
24
return r;
25
}