Retain some intermediate object files, suggested by Geert Stappers and Alexey Zaytsev.
[gpxe.git] / src / libgcc / __udivmoddi4.c
blob59966edb4a039533b11804afc4dcb00c4490d570
1 #include "libgcc.h"
3 LIBGCC uint64_t __udivmoddi4(uint64_t num, uint64_t den, uint64_t *rem_p)
5 uint64_t quot = 0, qbit = 1;
7 if ( den == 0 ) {
8 return 1/((unsigned)den); /* Intentional divide by zero, without
9 triggering a compiler warning which
10 would abort the build */
13 /* Left-justify denominator and count shift */
14 while ( (int64_t)den >= 0 ) {
15 den <<= 1;
16 qbit <<= 1;
19 while ( qbit ) {
20 if ( den <= num ) {
21 num -= den;
22 quot += qbit;
24 den >>= 1;
25 qbit >>= 1;
28 if ( rem_p )
29 *rem_p = num;
31 return quot;