aboutsummaryrefslogtreecommitdiffstats
path: root/include/bits
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/bits
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 'include/bits')
-rw-r--r--include/bits/types.h95
1 files changed, 95 insertions, 0 deletions
diff --git a/include/bits/types.h b/include/bits/types.h
index 41967f2..5d99e4f 100644
--- a/include/bits/types.h
+++ b/include/bits/types.h
@@ -25,6 +25,13 @@
#include <bits/intconf.h>
+/* Ensure that dependencies for type are defined. */
+#if defined(__NEED_imaxdiv_t) && !defined(__NEED_intmax_t)
+# define __NEED_intmax_t
+#endif
+
+
+
/**
* Returns the maximum value of an unsigned integer type,
* in that type.
@@ -267,3 +274,91 @@ typedef int sig_atomic_t;
# define __SIG_ATOMIC_BIT __INT_BIT
#endif
+
+/**
+ * A structure than holds both the quotient and
+ * the remainer in an integer division, of
+ * `int` type.
+ */
+#if defined(__NEED_div_t) && !defined(__DEFINED_div_t)
+# define __DEFINED_div_t
+typedef struct {
+ /**
+ * Quotient.
+ */
+ int quot;
+
+ /**
+ * Remainder.
+ */
+ int rem;
+
+} div_t;
+#endif
+
+
+/**
+ * A structure than holds both the quotient and
+ * the remainer in an integer division, of
+ * `long int` type.
+ */
+#if defined(__NEED_ldiv_t) && !defined(__DEFINED_ldiv_t)
+# define __DEFINED_ldiv_t
+typedef struct {
+ /**
+ * Quotient.
+ */
+ long int quot;
+
+ /**
+ * Remainder.
+ */
+ long int rem;
+
+} ldiv_t;
+#endif
+
+
+/**
+ * A structure than holds both the quotient and
+ * the remainer in an integer division, of
+ * `long long int` type.
+ */
+#if defined(__NEED_lldiv_t) && !defined(__DEFINED_lldiv_t)
+# define __DEFINED_lldiv_t
+typedef struct {
+ /**
+ * Quotient.
+ */
+ long long int quot;
+
+ /**
+ * Remainder.
+ */
+ long long int rem;
+
+} lldiv_t;
+#endif
+
+
+/**
+ * A structure than holds both the quotient and
+ * the remainer in an integer division, of
+ * `intmax_t` type.
+ */
+#if defined(__NEED_imaxdiv_t) && !defined(__DEFINED_imaxdiv_t)
+# define __DEFINED_imaxdiv_t
+typedef struct {
+ /**
+ * Quotient.
+ */
+ intmax_t quot;
+
+ /**
+ * Remainder.
+ */
+ intmax_t rem;
+
+} imaxdiv_t;
+#endif
+