summaryrefslogtreecommitdiff
path: root/LibC/stdlib.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-02-05 13:38:32 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-02-05 13:38:32 +0100
commitddb13ae6d87f92264e48ebd3bdbe1ded33437600 (patch)
tree7367dd766afdfc956511c88dbc0db5799a1c657d /LibC/stdlib.cpp
parentcaff611ca3bc90b4cf7ba93491d74e8ed975d44e (diff)
downloadserenity-ddb13ae6d87f92264e48ebd3bdbe1ded33437600.zip
LibC: Add some integer functionality needed for NASM.
Diffstat (limited to 'LibC/stdlib.cpp')
-rw-r--r--LibC/stdlib.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/LibC/stdlib.cpp b/LibC/stdlib.cpp
index 74fcfd9436..7afa23b98a 100644
--- a/LibC/stdlib.cpp
+++ b/LibC/stdlib.cpp
@@ -267,4 +267,20 @@ int system(const char* command)
return execl("/bin/sh", "sh", "-c", command, nullptr);
}
+div_t div(int numerator, int denominator)
+{
+ div_t result;
+ result.quot = numerator / denominator;
+ result.rem = numerator % denominator;
+ return result;
+}
+
+ldiv_t ldiv(long numerator, long denominator)
+{
+ ldiv_t result;
+ result.quot = numerator / denominator;
+ result.rem = numerator % denominator;
+ return result;
+}
+
}