Root/
Source at commit 1077 created 13 years 1 month ago. By azimutz, Removing this info from DEBUG's realm. This will be enabled by default until i gather enough feedback to decide whether it will stay On or Off by default. This info display, is only available on Gui; ShowInfo=No disables it. For the Gui minimalist, "Boot Banner"=No also disables it. Ok, "house cleaning" is suspended until i figure out what Meklort's cooking over at that new branch... "rewrite" :-o just the name sounds scary :-D | |
---|---|
1 | #include "libsaio.h"␊ |
2 | extern void __divide_error();␊ |
3 | uint32_t __udivmodsi4(uint32_t num, uint32_t den, uint32_t * rem_p)␊ |
4 | {␊ |
5 | ␉uint32_t quot = 0, qbit = 1;␊ |
6 | ␊ |
7 | ␉if (den == 0) {␊ |
8 | ␉␉__divide_error();␊ |
9 | ␉␉return 0;␉/* If trap returns... */␊ |
10 | ␉}␊ |
11 | ␊ |
12 | ␉/* Left-justify denominator and count shift */␊ |
13 | ␉while ((int32_t) den >= 0) {␊ |
14 | ␉␉den <<= 1;␊ |
15 | ␉␉qbit <<= 1;␊ |
16 | ␉}␊ |
17 | ␊ |
18 | ␉while (qbit) {␊ |
19 | ␉␉if (den <= num) {␊ |
20 | ␉␉␉num -= den;␊ |
21 | ␉␉␉quot += qbit;␊ |
22 | ␉␉}␊ |
23 | ␉␉den >>= 1;␊ |
24 | ␉␉qbit >>= 1;␊ |
25 | ␉}␊ |
26 | ␊ |
27 | ␉if (rem_p)␊ |
28 | ␉␉*rem_p = num;␊ |
29 | ␊ |
30 | ␉return quot;␊ |
31 | }␊ |
32 |