diff options
author | Mițca Dumitru <dumitru0mitca@gmail.com> | 2021-03-07 18:09:44 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-09 07:28:06 +0100 |
commit | 857b0e1dc342f7d515931ea27ad4766a95178a6e (patch) | |
tree | 2e596005b5e8ffb1b0f64d99444e821b7435fc16 /Userland/Libraries/LibC/stdlib.cpp | |
parent | 42a818672832e4e0a9228d05b8ac083dffcb2014 (diff) | |
download | serenity-857b0e1dc342f7d515931ea27ad4766a95178a6e.zip |
LibC: Add imaxdiv and lldiv
Diffstat (limited to 'Userland/Libraries/LibC/stdlib.cpp')
-rw-r--r-- | Userland/Libraries/LibC/stdlib.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Userland/Libraries/LibC/stdlib.cpp b/Userland/Libraries/LibC/stdlib.cpp index 0b599202a8..2ce2391646 100644 --- a/Userland/Libraries/LibC/stdlib.cpp +++ b/Userland/Libraries/LibC/stdlib.cpp @@ -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()"); |