aboutsummaryrefslogtreecommitdiffstats
path: root/include/stdlib.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/stdlib.h')
-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