ppc64: Don't set Kp bit on SLB
[openbios/afaerber.git] / libgcc / __udivmodti4.c
blobe373c59e60ea9c8a238634b39a939c365421d349
1 #include "libgcc.h"
3 __uint128_t __udivmodti4(__uint128_t num, __uint128_t den, __uint128_t *rem_p)
5 __uint128_t quot = 0, qbit = 1;
7 if ( den == 0 ) {
8 __divide_error();
9 return 0; /* If trap returns... */
12 /* Left-justify denominator and count shift */
13 while ( (__int128_t)den >= 0 ) {
14 den <<= 1;
15 qbit <<= 1;
18 while ( qbit ) {
19 if ( den <= num ) {
20 num -= den;
21 quot += qbit;
23 den >>= 1;
24 qbit >>= 1;
27 if ( rem_p )
28 *rem_p = num;
30 return quot;