diff options
Diffstat (limited to 'runtime/mppa_k1c/i64_smod.c')
-rw-r--r-- | runtime/mppa_k1c/i64_smod.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/runtime/mppa_k1c/i64_smod.c b/runtime/mppa_k1c/i64_smod.c new file mode 100644 index 00000000..26ffb39b --- /dev/null +++ b/runtime/mppa_k1c/i64_smod.c @@ -0,0 +1,40 @@ +#if COMPLIQUE +unsigned long long +udivmoddi4(unsigned long long num, unsigned long long den, int modwanted); + +long long +i64_smod (long long a, long long b) +{ + int neg = 0; + long long res; + + if (a < 0) + { + a = -a; + neg = 1; + } + + if (b < 0) + b = -b; + + res = udivmoddi4 (a, b, 1); + + if (neg) + res = -res; + + return res; +} + +#else +extern long __moddi3 (long a, long b); + +long i64_smod (long a, long b) +{ + return __moddi3 (a, b); +} + +int i32_smod (int a, int b) +{ + return __moddi3 (a, b); +} +#endif |