1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:47:34 +00:00

LibC: Add imaxdiv and lldiv

This commit is contained in:
Mițca Dumitru 2021-03-07 18:09:44 +02:00 committed by Andreas Kling
parent 42a8186728
commit 857b0e1dc3
5 changed files with 74 additions and 0 deletions

View file

@ -836,6 +836,19 @@ ldiv_t ldiv(long numerator, long denominator)
return result;
}
lldiv_t lldiv(long long numerator, long long denominator)
{
lldiv_t result;
result.quot = numerator / denominator;
result.rem = numerator % denominator;
if (numerator >= 0 && result.rem < 0) {
result.quot++;
result.rem -= denominator;
}
return result;
}
size_t mbstowcs(wchar_t*, const char*, size_t)
{
dbgln("FIXME: Implement mbstowcs()");