reactos/lib/sdk/crt/math/ldiv.c
Hermès Bélusca-Maïto b819608ed8 Create a branch for console restructuration work.
svn path=/branches/condrv_restructure/; revision=63104
2014-05-02 14:13:40 +00:00

28 lines
396 B
C

/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <precomp.h>
/*
* @implemented
*/
ldiv_t
ldiv(long num, long denom)
{
ldiv_t r;
if (num > 0 && denom < 0)
{
num = -num;
denom = -denom;
}
r.quot = num / denom;
r.rem = num % denom;
if (num < 0 && denom > 0)
{
if (r.rem > 0)
{
r.quot++;
r.rem -= denom;
}
}
return r;
}