]> pd.if.org Git - pdclib/commitdiff
Initial checkin.
authorsolar <unknown>
Mon, 5 Dec 2005 05:58:58 +0000 (05:58 +0000)
committersolar <unknown>
Mon, 5 Dec 2005 05:58:58 +0000 (05:58 +0000)
functions/stdlib/div.c [new file with mode: 0644]
functions/stdlib/ldiv.c [new file with mode: 0644]
functions/stdlib/lldiv.c [new file with mode: 0644]

diff --git a/functions/stdlib/div.c b/functions/stdlib/div.c
new file mode 100644 (file)
index 0000000..45961af
--- /dev/null
@@ -0,0 +1,37 @@
+/* $Id$ */
+
+/* Release $Name$ */
+
+/* div( int, int )
+
+   This file is part of the Public Domain C Library (PDCLib).
+   Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+#include <stdlib.h>
+
+#ifndef REGTEST
+
+div_t div( int numer, int denom )
+{
+    div_t rc;
+    rc.quot = numer / denom;
+    rc.rem  = numer % denom;
+    /* TODO: pre-C99 compilers might require modulus corrections */
+    return rc;
+}
+
+#endif
+
+#ifdef TEST
+#include <_PDCLIB_test.h>
+
+int main()
+{
+    int NO_TESTDRIVER = 0;
+    BEGIN_TESTS;
+    TESTCASE( NO_TESTDRIVER );
+    return TEST_RESULTS;
+}
+
+#endif
diff --git a/functions/stdlib/ldiv.c b/functions/stdlib/ldiv.c
new file mode 100644 (file)
index 0000000..92a56b9
--- /dev/null
@@ -0,0 +1,37 @@
+/* $Id$ */
+
+/* Release $Name$ */
+
+/* ldiv( int, int )
+
+   This file is part of the Public Domain C Library (PDCLib).
+   Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+#include <stdlib.h>
+
+#ifndef REGTEST
+
+ldiv_t ldiv( long int numer, long int denom )
+{
+    ldiv_t rc;
+    rc.quot = numer / denom;
+    rc.rem  = numer % denom;
+    /* TODO: pre-C99 compilers might require modulus correction */
+    return rc;
+}
+
+#endif
+
+#ifdef TEST
+#include <_PDCLIB_test.h>
+
+int main()
+{
+    int NO_TESTDRIVER = 0;
+    BEGIN_TESTS;
+    TESTCASE( NO_TESTDRIVER );
+    return TEST_RESULTS;
+}
+
+#endif
diff --git a/functions/stdlib/lldiv.c b/functions/stdlib/lldiv.c
new file mode 100644 (file)
index 0000000..349ff2b
--- /dev/null
@@ -0,0 +1,37 @@
+/* $Id$ */
+
+/* Release $Name$ */
+
+/* lldiv( long long int, long long int )
+
+   This file is part of the Public Domain C Library (PDCLib).
+   Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+#include <stdlib.h>
+
+#ifndef REGTEST
+
+lldiv_t lldiv( long long int numer, long long int denom )
+{
+    lldiv_t rc;
+    rc.quot = numer / denom;
+    rc.rem  = numer % denom;
+    /* TODO */
+    return rc;
+}
+
+#endif
+
+#ifdef TEST
+#include <_PDCLIB_test.h>
+
+int main()
+{
+    int NO_TESTDRIVER = 0;
+    BEGIN_TESTS;
+    TESTCASE( NO_TESTDRIVER );
+    return TEST_RESULTS;
+}
+
+#endif