aboutsummaryrefslogtreecommitdiffstats
path: root/include/stdlib.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-09-02 18:55:15 +0200
committerMattias Andrée <maandree@operamail.com>2015-09-02 18:55:15 +0200
commitaf389cd969ab7ae6507710cb8667660c3bd51577 (patch)
tree07b469cd4f78fd56f9324f8a3c18a8bf1755f629 /include/stdlib.h
parentadd WEOF to wchar.h (diff)
downloadslibc-af389cd969ab7ae6507710cb8667660c3bd51577.tar.gz
slibc-af389cd969ab7ae6507710cb8667660c3bd51577.tar.bz2
slibc-af389cd969ab7ae6507710cb8667660c3bd51577.tar.xz
add div functions
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--include/stdlib.h41
1 files changed, 38 insertions, 3 deletions
diff --git a/include/stdlib.h b/include/stdlib.h
index f24fbf3..fd78d27 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -27,9 +27,9 @@
#define __NEED_size_t
#define __NEED_wchar_t
-#define __NEED_div_t /* TODO not defined */
-#define __NEED_ldiv_t /* TODO not defined */
-#define __NEED_lldiv_t /* TODO not defined */
+#define __NEED_div_t
+#define __NEED_ldiv_t
+#define __NEED_lldiv_t
#include <bits/types.h>
@@ -56,5 +56,40 @@
+/**
+ * Perform an integer division and return
+ * both the quotient and the remainder.
+ *
+ * @param numerator The numerator.
+ * @param denominator The denominator.
+ * @return The quotient in `.quot`, and
+ * the remainder in `.rem`.
+ */
+div_t div(int, int);
+
+/**
+ * Perform an integer division and return
+ * both the quotient and the remainder.
+ *
+ * @param numerator The numerator.
+ * @param denominator The denominator.
+ * @return The quotient in `.quot`, and
+ * the remainder in `.rem`.
+ */
+ldiv_t ldiv(long, long);
+
+/**
+ * Perform an integer division and return
+ * both the quotient and the remainder.
+ *
+ * @param numerator The numerator.
+ * @param denominator The denominator.
+ * @return The quotient in `.quot`, and
+ * the remainder in `.rem`.
+ */
+lldiv_t lldiv(long long, long long);
+
+
+
#endif