Improve documentation

The Cosmo API documentation page is pretty good now
https://justine.lol/cosmopolitan/documentation.html
This commit is contained in:
Justine Tunney 2020-12-27 07:02:35 -08:00
parent 13437dd19b
commit 1bc3a25505
367 changed files with 2542 additions and 26178 deletions

View file

@ -83,10 +83,11 @@ __ledf2(fp_t a, fp_t b) {
}
}
#if defined(__ELF__)
// Alias for libgcc compatibility
FNALIAS(__cmpdf2, __ledf2);
#endif
COMPILER_RT_ABI enum LE_RESULT
__cmpdf2(fp_t a, fp_t b) {
return __ledf2(a, b);
}
enum GE_RESULT {
GE_LESS = -1,

View file

@ -83,10 +83,11 @@ __lesf2(fp_t a, fp_t b) {
}
}
#if defined(__ELF__)
// Alias for libgcc compatibility
FNALIAS(__cmpsf2, __lesf2);
#endif
COMPILER_RT_ABI enum LE_RESULT
__cmpsf2(fp_t a, fp_t b) {
return __lesf2(a, b);
}
enum GE_RESULT {
GE_LESS = -1,

View file

@ -52,18 +52,14 @@ enum LE_RESULT {
};
COMPILER_RT_ABI enum LE_RESULT __letf2(fp_t a, fp_t b) {
const srep_t aInt = toRep(a);
const srep_t bInt = toRep(b);
const rep_t aAbs = aInt & absMask;
const rep_t bAbs = bInt & absMask;
// If either a or b is NaN, they are unordered.
if (aAbs > infRep || bAbs > infRep) return LE_UNORDERED;
// If a and b are both zeros, they are equal.
if ((aAbs | bAbs) == 0) return LE_EQUAL;
// If at least one of a and b is positive, we get the same result comparing
// a and b as signed integers as we would with a floating-point compare.
if ((aInt & bInt) >= 0) {
@ -82,10 +78,10 @@ COMPILER_RT_ABI enum LE_RESULT __letf2(fp_t a, fp_t b) {
}
}
#if defined(__ELF__)
// Alias for libgcc compatibility
FNALIAS(__cmptf2, __letf2);
#endif
COMPILER_RT_ABI enum LE_RESULT __cmptf2(fp_t a, fp_t b) {
return __letf2(a, b);
}
enum GE_RESULT {
GE_LESS = -1,

View file

@ -45,7 +45,7 @@
# define crt_isfinite(x) __builtin_isfinite((x))
#elif defined(__GNUC__)
# define crt_isfinite(x) \
__extension__(({ \
(({ \
__typeof((x)) x_ = (x); \
!crt_isinf(x_) && !crt_isnan(x_); \
}))

View file

@ -63,8 +63,8 @@ typedef union
} udwords;
#ifdef CRT_HAS_128BIT
typedef int ti_int __attribute__ ((mode (TI)));
typedef unsigned tu_int __attribute__ ((mode (TI)));
typedef __int128 ti_int;
typedef unsigned __int128 tu_int;
typedef union
{
@ -141,7 +141,7 @@ typedef union
long double f;
} long_double_bits;
#if __STDC_VERSION__ >= 199901L
#if __STDC_VERSION__ >= 199901L && !defined(__STDC_NO_COMPLEX__)
typedef float _Complex Fcomplex;
typedef double _Complex Dcomplex;
typedef long double _Complex Lcomplex;

View file

@ -71,7 +71,7 @@ forceinline du_int udiv128by64to64default(du_int u1, du_int u0, du_int v,
forceinline du_int udiv128by64to64(du_int u1, du_int u0, du_int v, du_int *r) {
#ifdef __x86_64__
du_int result;
asm("div\t%2" : "=a"(result), "=d"(*r) : "r"(v), "a"(u0), "d"(u1) : "cc");
asm("div\t%2" : "=a"(result), "=d"(*r) : "r"(v), "0"(u0), "1"(u1) : "cc");
return result;
#else
return udiv128by64to64default(u1, u0, v, r);