summaryrefslogtreecommitdiffstats
path: root/mig_test/software/lib/divmod.c
diff options
context:
space:
mode:
Diffstat (limited to 'mig_test/software/lib/divmod.c')
-rw-r--r--mig_test/software/lib/divmod.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/mig_test/software/lib/divmod.c b/mig_test/software/lib/divmod.c
new file mode 100644
index 0000000..e810ea7
--- /dev/null
+++ b/mig_test/software/lib/divmod.c
@@ -0,0 +1,50 @@
+long udivmodsi4 ();
+
+long
+__divsi3 (long a, long b)
+{
+ int neg = 0;
+ long res;
+
+ if (a < 0)
+ {
+ a = -a;
+ neg = !neg;
+ }
+
+ if (b < 0)
+ {
+ b = -b;
+ neg = !neg;
+ }
+
+ res = udivmodsi4 (a, b, 0);
+
+ if (neg)
+ res = -res;
+
+ return res;
+}
+
+long
+__modsi3 (long a, long b)
+{
+ int neg = 0;
+ long res;
+
+ if (a < 0)
+ {
+ a = -a;
+ neg = 1;
+ }
+
+ if (b < 0)
+ b = -b;
+
+ res = udivmodsi4 (a, b, 1);
+
+ if (neg)
+ res = -res;
+
+ return res;
+}
OpenPOWER on IntegriCloud