2 #define divnorm(num, den, sign) \
26 divmodsi4(int modwanted
, unsigned long num
, unsigned long den
)
31 while (den
< num
&& bit
&& !(den
& (1L<<31)))
46 if (modwanted
) return num
;
51 #define exitdiv(sign, res) if (sign) { res = - res;} return res;
54 __modsi3 (long numerator
, long denominator
)
63 numerator
= -numerator
;
68 denominator
= -denominator
;
71 modul
= divmodsi4 (1, numerator
, denominator
);
79 __divsi3 (long numerator
, long denominator
)
84 divnorm (numerator
, denominator
, sign
);
86 dividend
= divmodsi4 (0, numerator
, denominator
);
87 exitdiv (sign
, dividend
);
91 __umodsi3 (unsigned long numerator
, unsigned long denominator
)
96 modul
= divmodsi4 (1, numerator
, denominator
);
101 __udivsi3 (unsigned long numerator
, unsigned long denominator
)
106 dividend
= divmodsi4 (0, numerator
, denominator
);
122 for (i
= -10000; i
< 10000; i
+= 8)
124 for (j
= -10000; j
< 10000; j
+= 11)
129 printf ("fail %d %d %d %d\n", i
, j
, k
, m
);