aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc/lib/libgcc/__moddi3.c
blob: ed64bbafc98971422c045dd20276c9fed0c4d35c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "libgcc.h"

s64 __moddi3(s64 num, s64 den)
{
	int minus = 0;
	s64 v;

	if (num < 0) {
		num = -num;
		minus = 1;
	}
	if (den < 0) {
		den = -den;
		minus ^= 1;
	}

	(void)__udivmoddi4(num, den, (u64 *) & v);
	if (minus)
		v = -v;

	return v;
}
EXPORT_SYMBOL(__moddi3);