#include "libgcc.h"Go to the source code of this file.
Functions | |
| __libgcc uint64_t | __udivmoddi4 (uint64_t num, uint64_t den, uint64_t *rem_p) |
Definition at line 3 of file __udivmoddi4.c.
Referenced by __divdi3(), __moddi3(), __udivdi3(), and __umoddi3().
00004 { 00005 uint64_t quot = 0, qbit = 1; 00006 00007 if ( den == 0 ) { 00008 return 1/((unsigned)den); /* Intentional divide by zero, without 00009 triggering a compiler warning which 00010 would abort the build */ 00011 } 00012 00013 /* Left-justify denominator and count shift */ 00014 while ( (int64_t)den >= 0 ) { 00015 den <<= 1; 00016 qbit <<= 1; 00017 } 00018 00019 while ( qbit ) { 00020 if ( den <= num ) { 00021 num -= den; 00022 quot += qbit; 00023 } 00024 den >>= 1; 00025 qbit >>= 1; 00026 } 00027 00028 if ( rem_p ) 00029 *rem_p = num; 00030 00031 return quot; 00032 }
1.5.7.1