mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-24 14:22:28 +00:00
Improve new C23 checked arithmetic feature
This commit is contained in:
parent
2a1c588826
commit
4eebd6b9dc
10 changed files with 341 additions and 15 deletions
22
libc/intrin/divti3.c
Normal file
22
libc/intrin/divti3.c
Normal file
|
@ -0,0 +1,22 @@
|
|||
#if 0
|
||||
/*─────────────────────────────────────────────────────────────────╗
|
||||
│ To the extent possible under law, Justine Tunney has waived │
|
||||
│ all copyright and related or neighboring rights to division, │
|
||||
│ as it is written in the following disclaimers: │
|
||||
│ • http://unlicense.org/ │
|
||||
│ • http://creativecommons.org/publicdomain/zero/1.0/ │
|
||||
╚─────────────────────────────────────────────────────────────────*/
|
||||
#endif
|
||||
#include "third_party/compiler_rt/int_lib.h"
|
||||
|
||||
/**
|
||||
* Divides 128-bit signed integers.
|
||||
*
|
||||
* @param a is numerator
|
||||
* @param b is denominator
|
||||
* @return quotient or result of division
|
||||
* @note rounds towards zero
|
||||
*/
|
||||
COMPILER_RT_ABI ti_int __divti3(ti_int a, ti_int b) {
|
||||
return __divmodti4(a, b, NULL);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue