mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 14:58:30 +00:00
Clean up more code
- Found some bugs in LLVM compiler-rt library - The useless LIBC_STUBS package is now deleted - Improve the overflow checking story even further - Get chibicc tests working in MODE=dbg mode again - The libc/isystem/ headers now have correctly named guards
This commit is contained in:
parent
afc58a8b41
commit
d7c79f43ef
294 changed files with 912 additions and 1208 deletions
|
@ -29,13 +29,13 @@ COMPILER_RT_ABI ti_int __divmodti4(ti_int a, ti_int b, tu_int *opt_out_rem) {
|
|||
}
|
||||
sa = a >> k; // sa = a < 0 ? -1 : 0
|
||||
sb = b >> k; // sb = b < 0 ? -1 : 0
|
||||
x = (a ^ sa) - sa; // negate if sa == -1
|
||||
y = (b ^ sb) - sb; // negate if sb == -1
|
||||
x = (tu_int)(a ^ sa) - sa; // negate if sa == -1
|
||||
y = (tu_int)(b ^ sb) - sb; // negate if sb == -1
|
||||
sq = sa ^ sb; // sign of quotient
|
||||
sr = sa; // sign of remainder
|
||||
q = __udivmodti4(x, y, &r); // unsigned divide
|
||||
q = (q ^ sq) - sq; // fix quotient sign
|
||||
r = (r ^ sr) - sr; // fix remainder sign
|
||||
q = (tu_int)(q ^ sq) - sq; // fix quotient sign
|
||||
r = (tu_int)(r ^ sr) - sr; // fix remainder sign
|
||||
if (opt_out_rem) *opt_out_rem = r;
|
||||
return q;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue