2 Copyright © 2009-2014, The AROS Development Team. All rights reserved.
8 void __attribute__((noreturn
)) __aeabi_ldiv0(uint64_t);
10 uint64_t __uldiv(uint64_t a
, uint64_t b
)
23 int first_bit_a
= __builtin_clz(a
>> 32);
24 int first_bit_b
= __builtin_clz(b
>> 32);
26 if (first_bit_a
== 32)
27 first_bit_a
+= __builtin_clz(a
& 0xffffffff);
28 if (first_bit_b
== 32)
29 first_bit_b
+= __builtin_clz(b
& 0xffffffff);
31 uint64_t mask
= 0x00000001ULL
<< (first_bit_b
-first_bit_a
);
32 b
<<= (first_bit_b
- first_bit_a
);
49 uint64_t __uldivmod_helper(uint64_t a
, uint64_t b
, uint64_t *remainder
)
53 quotient
= __uldiv(a
, b
);
55 *remainder
= a
- b
* quotient
;