mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 03:27:39 +00:00
Revert retabbing of net/http and tinymath (#1020)
This commit is contained in:
parent
3a8e01a77a
commit
2b315626f3
19 changed files with 672 additions and 672 deletions
|
@ -1,5 +1,5 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
||||
│ vi: set et ft=c ts=8 sts=2 sw=2 fenc=utf-8 :vi │
|
||||
╚──────────────────────────────────────────────────────────────────────────────╝
|
||||
│ │
|
||||
│ Optimized Routines │
|
||||
|
@ -55,7 +55,7 @@ biased_exponent (float f)
|
|||
if (UNLIKELY (ex == 0))
|
||||
{
|
||||
/* Subnormal case - we still need to get the exponent right for subnormal
|
||||
numbers as division may take us back inside the normal range. */
|
||||
numbers as division may take us back inside the normal range. */
|
||||
return ex - __builtin_clz (fi << 9);
|
||||
}
|
||||
return ex;
|
||||
|
@ -64,7 +64,7 @@ biased_exponent (float f)
|
|||
/* Fast implementation of scalar atan2f. Largest observed error is
|
||||
2.88ulps in [99.0, 101.0] x [99.0, 101.0]:
|
||||
atan2f(0x1.9332d8p+6, 0x1.8cb6c4p+6) got 0x1.964646p-1
|
||||
want 0x1.964640p-1. */
|
||||
want 0x1.964640p-1. */
|
||||
float
|
||||
atan2f (float y, float x)
|
||||
{
|
||||
|
@ -96,15 +96,15 @@ atan2f (float y, float x)
|
|||
if (UNLIKELY (iay == 0 || (exp_diff >= POLY_UFLOW_BOUND && m >= 2)))
|
||||
{
|
||||
switch (m)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
return y; /* atan(+-0,+anything)=+-0. */
|
||||
case 2:
|
||||
return Pi; /* atan(+0,-anything) = pi. */
|
||||
case 3:
|
||||
return -Pi; /* atan(-0,-anything) =-pi. */
|
||||
}
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
return y; /* atan(+-0,+anything)=+-0. */
|
||||
case 2:
|
||||
return Pi; /* atan(+0,-anything) = pi. */
|
||||
case 3:
|
||||
return -Pi; /* atan(-0,-anything) =-pi. */
|
||||
}
|
||||
}
|
||||
/* Special case for (x, y) either on or very close to the y axis. Either x =
|
||||
0, or x is tiny and y is huge (difference in exponents >=
|
||||
|
@ -116,33 +116,33 @@ atan2f (float y, float x)
|
|||
if (iax == 0x7f800000)
|
||||
{
|
||||
if (iay == 0x7f800000)
|
||||
{
|
||||
switch (m)
|
||||
{
|
||||
case 0:
|
||||
return PiOver4; /* atan(+INF,+INF). */
|
||||
case 1:
|
||||
return -PiOver4; /* atan(-INF,+INF). */
|
||||
case 2:
|
||||
return 3.0f * PiOver4; /* atan(+INF,-INF). */
|
||||
case 3:
|
||||
return -3.0f * PiOver4; /* atan(-INF,-INF). */
|
||||
}
|
||||
}
|
||||
{
|
||||
switch (m)
|
||||
{
|
||||
case 0:
|
||||
return PiOver4; /* atan(+INF,+INF). */
|
||||
case 1:
|
||||
return -PiOver4; /* atan(-INF,+INF). */
|
||||
case 2:
|
||||
return 3.0f * PiOver4; /* atan(+INF,-INF). */
|
||||
case 3:
|
||||
return -3.0f * PiOver4; /* atan(-INF,-INF). */
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (m)
|
||||
{
|
||||
case 0:
|
||||
return 0.0f; /* atan(+...,+INF). */
|
||||
case 1:
|
||||
return -0.0f; /* atan(-...,+INF). */
|
||||
case 2:
|
||||
return Pi; /* atan(+...,-INF). */
|
||||
case 3:
|
||||
return -Pi; /* atan(-...,-INF). */
|
||||
}
|
||||
}
|
||||
{
|
||||
switch (m)
|
||||
{
|
||||
case 0:
|
||||
return 0.0f; /* atan(+...,+INF). */
|
||||
case 1:
|
||||
return -0.0f; /* atan(-...,+INF). */
|
||||
case 2:
|
||||
return Pi; /* atan(+...,-INF). */
|
||||
case 3:
|
||||
return -Pi; /* atan(-...,-INF). */
|
||||
}
|
||||
}
|
||||
}
|
||||
/* y is INF. */
|
||||
if (iay == 0x7f800000)
|
||||
|
@ -164,7 +164,7 @@ atan2f (float y, float x)
|
|||
if (UNLIKELY (m < 2 && exp_diff >= POLY_UFLOW_BOUND))
|
||||
{
|
||||
/* If (x, y) is very close to x axis and x is positive, the polynomial
|
||||
will underflow and evaluate to z. */
|
||||
will underflow and evaluate to z. */
|
||||
ret = z;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
||||
│ vi: set et ft=c ts=8 sts=2 sw=2 fenc=utf-8 :vi │
|
||||
╚──────────────────────────────────────────────────────────────────────────────╝
|
||||
│ │
|
||||
│ Optimized Routines │
|
||||
|
@ -35,12 +35,12 @@ asm(".include \"libc/disclaimer.inc\"");
|
|||
|
||||
const struct atan_poly_data __atan_poly_data = {
|
||||
.poly = {/* Coefficients of polynomial P such that atan(x)~x+x*P(x^2) on
|
||||
[2**-1022, 1.0]. See atan.sollya for details of how these were
|
||||
generated. */
|
||||
-0x1.5555555555555p-2, 0x1.99999999996c1p-3, -0x1.2492492478f88p-3,
|
||||
0x1.c71c71bc3951cp-4, -0x1.745d160a7e368p-4, 0x1.3b139b6a88ba1p-4,
|
||||
-0x1.11100ee084227p-4, 0x1.e1d0f9696f63bp-5, -0x1.aebfe7b418581p-5,
|
||||
0x1.842dbe9b0d916p-5, -0x1.5d30140ae5e99p-5, 0x1.338e31eb2fbbcp-5,
|
||||
-0x1.00e6eece7de8p-5, 0x1.860897b29e5efp-6, -0x1.0051381722a59p-6,
|
||||
0x1.14e9dc19a4a4ep-7, -0x1.d0062b42fe3bfp-9, 0x1.17739e210171ap-10,
|
||||
-0x1.ab24da7be7402p-13, 0x1.358851160a528p-16}};
|
||||
[2**-1022, 1.0]. See atan.sollya for details of how these were
|
||||
generated. */
|
||||
-0x1.5555555555555p-2, 0x1.99999999996c1p-3, -0x1.2492492478f88p-3,
|
||||
0x1.c71c71bc3951cp-4, -0x1.745d160a7e368p-4, 0x1.3b139b6a88ba1p-4,
|
||||
-0x1.11100ee084227p-4, 0x1.e1d0f9696f63bp-5, -0x1.aebfe7b418581p-5,
|
||||
0x1.842dbe9b0d916p-5, -0x1.5d30140ae5e99p-5, 0x1.338e31eb2fbbcp-5,
|
||||
-0x1.00e6eece7de8p-5, 0x1.860897b29e5efp-6, -0x1.0051381722a59p-6,
|
||||
0x1.14e9dc19a4a4ep-7, -0x1.d0062b42fe3bfp-9, 0x1.17739e210171ap-10,
|
||||
-0x1.ab24da7be7402p-13, 0x1.358851160a528p-16}};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
||||
│ vi: set et ft=c ts=8 sts=2 sw=2 fenc=utf-8 :vi │
|
||||
╚──────────────────────────────────────────────────────────────────────────────╝
|
||||
│ │
|
||||
│ Optimized Routines │
|
||||
|
@ -37,5 +37,5 @@ asm(".include \"libc/disclaimer.inc\"");
|
|||
*/
|
||||
const struct atanf_poly_data __atanf_poly_data = {
|
||||
.poly = {/* See atanf.sollya for details of how these were generated. */
|
||||
-0x1.55555p-2f, 0x1.99935ep-3f, -0x1.24051ep-3f, 0x1.bd7368p-4f,
|
||||
-0x1.491f0ep-4f, 0x1.93a2c0p-5f, -0x1.4c3c60p-6f, 0x1.01fd88p-8f}};
|
||||
-0x1.55555p-2f, 0x1.99935ep-3f, -0x1.24051ep-3f, 0x1.bd7368p-4f,
|
||||
-0x1.491f0ep-4f, 0x1.93a2c0p-5f, -0x1.4c3c60p-6f, 0x1.01fd88p-8f}};
|
||||
|
|
|
@ -81,11 +81,11 @@ expm1f(float x)
|
|||
/* filter out huge and non-finite argument */
|
||||
if(hx >= 0x4195b844) { /* if |x|>=27*ln2 */
|
||||
if(hx >= 0x42b17218) { /* if |x|>=88.721... */
|
||||
if(hx>0x7f800000)
|
||||
if(hx>0x7f800000)
|
||||
return x+x; /* NaN */
|
||||
if(hx==0x7f800000)
|
||||
return (xsb==0)? x:-1.0;/* exp(+-inf)={inf,-1} */
|
||||
if(x > o_threshold) return huge*huge; /* overflow */
|
||||
if(x > o_threshold) return huge*huge; /* overflow */
|
||||
}
|
||||
if(xsb!=0) { /* x < -27*ln2, return -1.0 with inexact */
|
||||
if(x+tiny<(float)0.0) /* raise inexact */
|
||||
|
@ -132,14 +132,14 @@ expm1f(float x)
|
|||
else return one+(float)2.0*(x-e);
|
||||
}
|
||||
if (k <= -2 || k>56) { /* suffice to return exp(x)-1 */
|
||||
y = one-(e-x);
|
||||
y = one-(e-x);
|
||||
if (k == 128) y = y*2.0F*0x1p127F;
|
||||
else y = y*twopk;
|
||||
return y-one;
|
||||
return y-one;
|
||||
}
|
||||
t = one;
|
||||
if(k<23) {
|
||||
SET_FLOAT_WORD(t,0x3f800000 - (0x1000000>>k)); /* t=1-2^-k */
|
||||
SET_FLOAT_WORD(t,0x3f800000 - (0x1000000>>k)); /* t=1-2^-k */
|
||||
y = t-(e-x);
|
||||
y = y*twopk;
|
||||
} else {
|
||||
|
|
|
@ -90,19 +90,19 @@ asm(".include \"libc/disclaimer.inc\"");
|
|||
#define INSERT(d,hi,lo) (d)=ASDOUBLE((uint64_t)(hi)<<32|(uint32_t)(lo))
|
||||
|
||||
static const double T[] = {
|
||||
3.33333333333334091986e-01, /* 3FD55555, 55555563 */
|
||||
1.33333333333201242699e-01, /* 3FC11111, 1110FE7A */
|
||||
5.39682539762260521377e-02, /* 3FABA1BA, 1BB341FE */
|
||||
2.18694882948595424599e-02, /* 3F9664F4, 8406D637 */
|
||||
8.86323982359930005737e-03, /* 3F8226E3, E96E8493 */
|
||||
3.59207910759131235356e-03, /* 3F6D6D22, C9560328 */
|
||||
1.45620945432529025516e-03, /* 3F57DBC8, FEE08315 */
|
||||
5.88041240820264096874e-04, /* 3F4344D8, F2F26501 */
|
||||
2.46463134818469906812e-04, /* 3F3026F7, 1A8D1068 */
|
||||
7.81794442939557092300e-05, /* 3F147E88, A03792A6 */
|
||||
7.14072491382608190305e-05, /* 3F12B80F, 32F0A7E9 */
|
||||
-1.85586374855275456654e-05, /* BEF375CB, DB605373 */
|
||||
2.59073051863633712884e-05, /* 3EFB2A70, 74BF7AD4 */
|
||||
3.33333333333334091986e-01, /* 3FD55555, 55555563 */
|
||||
1.33333333333201242699e-01, /* 3FC11111, 1110FE7A */
|
||||
5.39682539762260521377e-02, /* 3FABA1BA, 1BB341FE */
|
||||
2.18694882948595424599e-02, /* 3F9664F4, 8406D637 */
|
||||
8.86323982359930005737e-03, /* 3F8226E3, E96E8493 */
|
||||
3.59207910759131235356e-03, /* 3F6D6D22, C9560328 */
|
||||
1.45620945432529025516e-03, /* 3F57DBC8, FEE08315 */
|
||||
5.88041240820264096874e-04, /* 3F4344D8, F2F26501 */
|
||||
2.46463134818469906812e-04, /* 3F3026F7, 1A8D1068 */
|
||||
7.81794442939557092300e-05, /* 3F147E88, A03792A6 */
|
||||
7.14072491382608190305e-05, /* 3F12B80F, 32F0A7E9 */
|
||||
-1.85586374855275456654e-05, /* BEF375CB, DB605373 */
|
||||
2.59073051863633712884e-05, /* 3EFB2A70, 74BF7AD4 */
|
||||
},
|
||||
pio4 = 7.85398163397448278999e-01, /* 3FE921FB, 54442D18 */
|
||||
pio4lo = 3.06161699786838301793e-17; /* 3C81A626, 33145C07 */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
||||
│ vi: set et ft=c ts=8 sts=2 sw=2 fenc=utf-8 :vi │
|
||||
╚──────────────────────────────────────────────────────────────────────────────╝
|
||||
│ │
|
||||
│ Optimized Routines │
|
||||
|
@ -105,35 +105,35 @@ log1pf (float x)
|
|||
|
||||
/* Handle special cases first. */
|
||||
if (UNLIKELY (ia12 >= 0x7f8 || ix >= 0xbf800000 || ix == 0x80000000
|
||||
|| e <= TINY_BOUND_BEXP))
|
||||
|| e <= TINY_BOUND_BEXP))
|
||||
{
|
||||
if (ix == 0xff800000)
|
||||
{
|
||||
/* x == -Inf => log1pf(x) = NaN. */
|
||||
return NAN;
|
||||
}
|
||||
{
|
||||
/* x == -Inf => log1pf(x) = NaN. */
|
||||
return NAN;
|
||||
}
|
||||
if ((ix == 0x7f800000 || e <= TINY_BOUND_BEXP) && ia12 <= 0x7f8)
|
||||
{
|
||||
/* |x| < TinyBound => log1p(x) = x.
|
||||
x == Inf => log1pf(x) = Inf. */
|
||||
return x;
|
||||
}
|
||||
{
|
||||
/* |x| < TinyBound => log1p(x) = x.
|
||||
x == Inf => log1pf(x) = Inf. */
|
||||
return x;
|
||||
}
|
||||
if (ix == 0xbf800000)
|
||||
{
|
||||
/* x == -1.0 => log1pf(x) = -Inf. */
|
||||
return __math_divzerof (-1);
|
||||
}
|
||||
{
|
||||
/* x == -1.0 => log1pf(x) = -Inf. */
|
||||
return __math_divzerof (-1);
|
||||
}
|
||||
if (ia12 >= 0x7f8)
|
||||
{
|
||||
/* x == +/-NaN => log1pf(x) = NaN. */
|
||||
return __math_invalidf (asfloat (ia));
|
||||
}
|
||||
{
|
||||
/* x == +/-NaN => log1pf(x) = NaN. */
|
||||
return __math_invalidf (asfloat (ia));
|
||||
}
|
||||
/* x < -1.0 => log1pf(x) = NaN. */
|
||||
return __math_invalidf (x);
|
||||
}
|
||||
|
||||
/* With x + 1 = t * 2^k (where t = m + 1 and k is chosen such that m
|
||||
is in [-0.25, 0.5]):
|
||||
is in [-0.25, 0.5]):
|
||||
log1p(x) = log(t) + log(2^k) = log1p(m) + k*log(2).
|
||||
|
||||
We approximate log1p(m) with a polynomial, then scale by
|
||||
|
@ -144,8 +144,8 @@ log1pf (float x)
|
|||
if (ix <= 0x3f000000 || ia <= 0x3e800000)
|
||||
{
|
||||
/* If x is in [-0.25, 0.5] then we can shortcut all the logic
|
||||
below, as k = 0 and m = x. All we need is to return the
|
||||
polynomial. */
|
||||
below, as k = 0 and m = x. All we need is to return the
|
||||
polynomial. */
|
||||
return eval_poly (x, e);
|
||||
}
|
||||
|
||||
|
@ -154,10 +154,10 @@ log1pf (float x)
|
|||
/* k is used scale the input. 0x3f400000 is chosen as we are trying to
|
||||
reduce x to the range [-0.25, 0.5]. Inside this range, k is 0.
|
||||
Outside this range, if k is reinterpreted as (NOT CONVERTED TO) float:
|
||||
let k = sign * 2^p where sign = -1 if x < 0
|
||||
1 otherwise
|
||||
and p is a negative integer whose magnitude increases with the
|
||||
magnitude of x. */
|
||||
let k = sign * 2^p where sign = -1 if x < 0
|
||||
1 otherwise
|
||||
and p is a negative integer whose magnitude increases with the
|
||||
magnitude of x. */
|
||||
int k = (asuint (m) - 0x3f400000) & 0xff800000;
|
||||
|
||||
/* By using integer arithmetic, we obtain the necessary scaling by
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
||||
│ vi: set et ft=c ts=8 sts=2 sw=2 fenc=utf-8 :vi │
|
||||
╚──────────────────────────────────────────────────────────────────────────────╝
|
||||
│ │
|
||||
│ Optimized Routines │
|
||||
|
@ -37,5 +37,5 @@ asm(".include \"libc/disclaimer.inc\"");
|
|||
algorithm, see tools/log1pf.sollya for details. */
|
||||
const struct log1pf_data __log1pf_data
|
||||
= {.coeffs = {-0x1p-1f, 0x1.5555aap-2f, -0x1.000038p-2f, 0x1.99675cp-3f,
|
||||
-0x1.54ef78p-3f, 0x1.28a1f4p-3f, -0x1.0da91p-3f, 0x1.abcb6p-4f,
|
||||
-0x1.6f0d5ep-5f}};
|
||||
-0x1.54ef78p-3f, 0x1.28a1f4p-3f, -0x1.0da91p-3f, 0x1.abcb6p-4f,
|
||||
-0x1.6f0d5ep-5f}};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
||||
│ vi: set et ft=c ts=8 sts=2 sw=2 fenc=utf-8 :vi │
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2021 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
|
@ -292,229 +292,229 @@ static long double powil(long double, int);
|
|||
|
||||
long double powl(long double x, long double y)
|
||||
{
|
||||
/* double F, Fa, Fb, G, Ga, Gb, H, Ha, Hb */
|
||||
int i, nflg, iyflg, yoddint;
|
||||
long e;
|
||||
volatile long double z=0;
|
||||
long double w=0, W=0, Wa=0, Wb=0, ya=0, yb=0, u=0;
|
||||
/* double F, Fa, Fb, G, Ga, Gb, H, Ha, Hb */
|
||||
int i, nflg, iyflg, yoddint;
|
||||
long e;
|
||||
volatile long double z=0;
|
||||
long double w=0, W=0, Wa=0, Wb=0, ya=0, yb=0, u=0;
|
||||
|
||||
/* make sure no invalid exception is raised by nan comparision */
|
||||
if (isnan(x)) {
|
||||
if (!isnan(y) && y == 0.0)
|
||||
return 1.0;
|
||||
return x;
|
||||
}
|
||||
if (isnan(y)) {
|
||||
if (x == 1.0)
|
||||
return 1.0;
|
||||
return y;
|
||||
}
|
||||
if (x == 1.0)
|
||||
return 1.0; /* 1**y = 1, even if y is nan */
|
||||
if (x == -1.0 && !isfinite(y))
|
||||
return 1.0; /* -1**inf = 1 */
|
||||
if (y == 0.0)
|
||||
return 1.0; /* x**0 = 1, even if x is nan */
|
||||
if (y == 1.0)
|
||||
return x;
|
||||
if (y >= LDBL_MAX) {
|
||||
if (x > 1.0 || x < -1.0)
|
||||
return INFINITY;
|
||||
if (x != 0.0)
|
||||
return 0.0;
|
||||
}
|
||||
if (y <= -LDBL_MAX) {
|
||||
if (x > 1.0 || x < -1.0)
|
||||
return 0.0;
|
||||
if (x != 0.0 || y == -INFINITY)
|
||||
return INFINITY;
|
||||
}
|
||||
if (x >= LDBL_MAX) {
|
||||
if (y > 0.0)
|
||||
return INFINITY;
|
||||
return 0.0;
|
||||
}
|
||||
/* make sure no invalid exception is raised by nan comparision */
|
||||
if (isnan(x)) {
|
||||
if (!isnan(y) && y == 0.0)
|
||||
return 1.0;
|
||||
return x;
|
||||
}
|
||||
if (isnan(y)) {
|
||||
if (x == 1.0)
|
||||
return 1.0;
|
||||
return y;
|
||||
}
|
||||
if (x == 1.0)
|
||||
return 1.0; /* 1**y = 1, even if y is nan */
|
||||
if (x == -1.0 && !isfinite(y))
|
||||
return 1.0; /* -1**inf = 1 */
|
||||
if (y == 0.0)
|
||||
return 1.0; /* x**0 = 1, even if x is nan */
|
||||
if (y == 1.0)
|
||||
return x;
|
||||
if (y >= LDBL_MAX) {
|
||||
if (x > 1.0 || x < -1.0)
|
||||
return INFINITY;
|
||||
if (x != 0.0)
|
||||
return 0.0;
|
||||
}
|
||||
if (y <= -LDBL_MAX) {
|
||||
if (x > 1.0 || x < -1.0)
|
||||
return 0.0;
|
||||
if (x != 0.0 || y == -INFINITY)
|
||||
return INFINITY;
|
||||
}
|
||||
if (x >= LDBL_MAX) {
|
||||
if (y > 0.0)
|
||||
return INFINITY;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
w = floorl(y);
|
||||
w = floorl(y);
|
||||
|
||||
/* Set iyflg to 1 if y is an integer. */
|
||||
iyflg = 0;
|
||||
if (w == y)
|
||||
iyflg = 1;
|
||||
/* Set iyflg to 1 if y is an integer. */
|
||||
iyflg = 0;
|
||||
if (w == y)
|
||||
iyflg = 1;
|
||||
|
||||
/* Test for odd integer y. */
|
||||
yoddint = 0;
|
||||
if (iyflg) {
|
||||
ya = fabsl(y);
|
||||
ya = floorl(0.5 * ya);
|
||||
yb = 0.5 * fabsl(w);
|
||||
if( ya != yb )
|
||||
yoddint = 1;
|
||||
}
|
||||
/* Test for odd integer y. */
|
||||
yoddint = 0;
|
||||
if (iyflg) {
|
||||
ya = fabsl(y);
|
||||
ya = floorl(0.5 * ya);
|
||||
yb = 0.5 * fabsl(w);
|
||||
if( ya != yb )
|
||||
yoddint = 1;
|
||||
}
|
||||
|
||||
if (x <= -LDBL_MAX) {
|
||||
if (y > 0.0) {
|
||||
if (yoddint)
|
||||
return -INFINITY;
|
||||
return INFINITY;
|
||||
}
|
||||
if (y < 0.0) {
|
||||
if (yoddint)
|
||||
return -0.0;
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
nflg = 0; /* (x<0)**(odd int) */
|
||||
if (x <= 0.0) {
|
||||
if (x == 0.0) {
|
||||
if (y < 0.0) {
|
||||
if (signbit(x) && yoddint)
|
||||
/* (-0.0)**(-odd int) = -inf, divbyzero */
|
||||
return -1.0/0.0;
|
||||
/* (+-0.0)**(negative) = inf, divbyzero */
|
||||
return 1.0/0.0;
|
||||
}
|
||||
if (signbit(x) && yoddint)
|
||||
return -0.0;
|
||||
return 0.0;
|
||||
}
|
||||
if (iyflg == 0)
|
||||
return (x - x) / (x - x); /* (x<0)**(non-int) is NaN */
|
||||
/* (x<0)**(integer) */
|
||||
if (yoddint)
|
||||
nflg = 1; /* negate result */
|
||||
x = -x;
|
||||
}
|
||||
/* (+integer)**(integer) */
|
||||
if (iyflg && floorl(x) == x && fabsl(y) < 32768.0) {
|
||||
w = powil(x, (int)y);
|
||||
return nflg ? -w : w;
|
||||
}
|
||||
if (x <= -LDBL_MAX) {
|
||||
if (y > 0.0) {
|
||||
if (yoddint)
|
||||
return -INFINITY;
|
||||
return INFINITY;
|
||||
}
|
||||
if (y < 0.0) {
|
||||
if (yoddint)
|
||||
return -0.0;
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
nflg = 0; /* (x<0)**(odd int) */
|
||||
if (x <= 0.0) {
|
||||
if (x == 0.0) {
|
||||
if (y < 0.0) {
|
||||
if (signbit(x) && yoddint)
|
||||
/* (-0.0)**(-odd int) = -inf, divbyzero */
|
||||
return -1.0/0.0;
|
||||
/* (+-0.0)**(negative) = inf, divbyzero */
|
||||
return 1.0/0.0;
|
||||
}
|
||||
if (signbit(x) && yoddint)
|
||||
return -0.0;
|
||||
return 0.0;
|
||||
}
|
||||
if (iyflg == 0)
|
||||
return (x - x) / (x - x); /* (x<0)**(non-int) is NaN */
|
||||
/* (x<0)**(integer) */
|
||||
if (yoddint)
|
||||
nflg = 1; /* negate result */
|
||||
x = -x;
|
||||
}
|
||||
/* (+integer)**(integer) */
|
||||
if (iyflg && floorl(x) == x && fabsl(y) < 32768.0) {
|
||||
w = powil(x, (int)y);
|
||||
return nflg ? -w : w;
|
||||
}
|
||||
|
||||
/* separate significand from exponent */
|
||||
x = frexpl(x, &i);
|
||||
e = i;
|
||||
/* separate significand from exponent */
|
||||
x = frexpl(x, &i);
|
||||
e = i;
|
||||
|
||||
/* find significand in antilog table A[] */
|
||||
i = 1;
|
||||
if (x <= A[17])
|
||||
i = 17;
|
||||
if (x <= A[i+8])
|
||||
i += 8;
|
||||
if (x <= A[i+4])
|
||||
i += 4;
|
||||
if (x <= A[i+2])
|
||||
i += 2;
|
||||
if (x >= A[1])
|
||||
i = -1;
|
||||
i += 1;
|
||||
/* find significand in antilog table A[] */
|
||||
i = 1;
|
||||
if (x <= A[17])
|
||||
i = 17;
|
||||
if (x <= A[i+8])
|
||||
i += 8;
|
||||
if (x <= A[i+4])
|
||||
i += 4;
|
||||
if (x <= A[i+2])
|
||||
i += 2;
|
||||
if (x >= A[1])
|
||||
i = -1;
|
||||
i += 1;
|
||||
|
||||
/* Find (x - A[i])/A[i]
|
||||
* in order to compute log(x/A[i]):
|
||||
*
|
||||
* log(x) = log( a x/a ) = log(a) + log(x/a)
|
||||
*
|
||||
* log(x/a) = log(1+v), v = x/a - 1 = (x-a)/a
|
||||
*/
|
||||
x -= A[i];
|
||||
x -= B[i/2];
|
||||
x /= A[i];
|
||||
/* Find (x - A[i])/A[i]
|
||||
* in order to compute log(x/A[i]):
|
||||
*
|
||||
* log(x) = log( a x/a ) = log(a) + log(x/a)
|
||||
*
|
||||
* log(x/a) = log(1+v), v = x/a - 1 = (x-a)/a
|
||||
*/
|
||||
x -= A[i];
|
||||
x -= B[i/2];
|
||||
x /= A[i];
|
||||
|
||||
/* rational approximation for log(1+v):
|
||||
*
|
||||
* log(1+v) = v - v**2/2 + v**3 P(v) / Q(v)
|
||||
*/
|
||||
z = x*x;
|
||||
w = x * (z * __polevll(x, P, 3) / __p1evll(x, Q, 3));
|
||||
w = w - 0.5*z;
|
||||
/* rational approximation for log(1+v):
|
||||
*
|
||||
* log(1+v) = v - v**2/2 + v**3 P(v) / Q(v)
|
||||
*/
|
||||
z = x*x;
|
||||
w = x * (z * __polevll(x, P, 3) / __p1evll(x, Q, 3));
|
||||
w = w - 0.5*z;
|
||||
|
||||
/* Convert to base 2 logarithm:
|
||||
* multiply by log2(e) = 1 + LOG2EA
|
||||
*/
|
||||
z = LOG2EA * w;
|
||||
z += w;
|
||||
z += LOG2EA * x;
|
||||
z += x;
|
||||
/* Convert to base 2 logarithm:
|
||||
* multiply by log2(e) = 1 + LOG2EA
|
||||
*/
|
||||
z = LOG2EA * w;
|
||||
z += w;
|
||||
z += LOG2EA * x;
|
||||
z += x;
|
||||
|
||||
/* Compute exponent term of the base 2 logarithm. */
|
||||
w = -i;
|
||||
w /= NXT;
|
||||
w += e;
|
||||
/* Now base 2 log of x is w + z. */
|
||||
/* Compute exponent term of the base 2 logarithm. */
|
||||
w = -i;
|
||||
w /= NXT;
|
||||
w += e;
|
||||
/* Now base 2 log of x is w + z. */
|
||||
|
||||
/* Multiply base 2 log by y, in extended precision. */
|
||||
/* Multiply base 2 log by y, in extended precision. */
|
||||
|
||||
/* separate y into large part ya
|
||||
* and small part yb less than 1/NXT
|
||||
*/
|
||||
ya = reducl(y);
|
||||
yb = y - ya;
|
||||
/* separate y into large part ya
|
||||
* and small part yb less than 1/NXT
|
||||
*/
|
||||
ya = reducl(y);
|
||||
yb = y - ya;
|
||||
|
||||
/* (w+z)(ya+yb)
|
||||
* = w*ya + w*yb + z*y
|
||||
*/
|
||||
F = z * y + w * yb;
|
||||
Fa = reducl(F);
|
||||
Fb = F - Fa;
|
||||
/* (w+z)(ya+yb)
|
||||
* = w*ya + w*yb + z*y
|
||||
*/
|
||||
F = z * y + w * yb;
|
||||
Fa = reducl(F);
|
||||
Fb = F - Fa;
|
||||
|
||||
G = Fa + w * ya;
|
||||
Ga = reducl(G);
|
||||
Gb = G - Ga;
|
||||
G = Fa + w * ya;
|
||||
Ga = reducl(G);
|
||||
Gb = G - Ga;
|
||||
|
||||
H = Fb + Gb;
|
||||
Ha = reducl(H);
|
||||
w = (Ga + Ha) * NXT;
|
||||
H = Fb + Gb;
|
||||
Ha = reducl(H);
|
||||
w = (Ga + Ha) * NXT;
|
||||
|
||||
/* Test the power of 2 for overflow */
|
||||
if (w > MEXP)
|
||||
return huge * huge; /* overflow */
|
||||
if (w < MNEXP)
|
||||
return twom10000 * twom10000; /* underflow */
|
||||
/* Test the power of 2 for overflow */
|
||||
if (w > MEXP)
|
||||
return huge * huge; /* overflow */
|
||||
if (w < MNEXP)
|
||||
return twom10000 * twom10000; /* underflow */
|
||||
|
||||
e = w;
|
||||
Hb = H - Ha;
|
||||
e = w;
|
||||
Hb = H - Ha;
|
||||
|
||||
if (Hb > 0.0) {
|
||||
e += 1;
|
||||
Hb -= 1.0/NXT; /*0.0625L;*/
|
||||
}
|
||||
if (Hb > 0.0) {
|
||||
e += 1;
|
||||
Hb -= 1.0/NXT; /*0.0625L;*/
|
||||
}
|
||||
|
||||
/* Now the product y * log2(x) = Hb + e/NXT.
|
||||
*
|
||||
* Compute base 2 exponential of Hb,
|
||||
* where -0.0625 <= Hb <= 0.
|
||||
*/
|
||||
z = Hb * __polevll(Hb, R, 6); /* z = 2**Hb - 1 */
|
||||
/* Now the product y * log2(x) = Hb + e/NXT.
|
||||
*
|
||||
* Compute base 2 exponential of Hb,
|
||||
* where -0.0625 <= Hb <= 0.
|
||||
*/
|
||||
z = Hb * __polevll(Hb, R, 6); /* z = 2**Hb - 1 */
|
||||
|
||||
/* Express e/NXT as an integer plus a negative number of (1/NXT)ths.
|
||||
* Find lookup table entry for the fractional power of 2.
|
||||
*/
|
||||
if (e < 0)
|
||||
i = 0;
|
||||
else
|
||||
i = 1;
|
||||
i = e/NXT + i;
|
||||
e = NXT*i - e;
|
||||
w = A[e];
|
||||
z = w * z; /* 2**-e * ( 1 + (2**Hb-1) ) */
|
||||
z = z + w;
|
||||
z = scalbnl(z, i); /* multiply by integer power of 2 */
|
||||
/* Express e/NXT as an integer plus a negative number of (1/NXT)ths.
|
||||
* Find lookup table entry for the fractional power of 2.
|
||||
*/
|
||||
if (e < 0)
|
||||
i = 0;
|
||||
else
|
||||
i = 1;
|
||||
i = e/NXT + i;
|
||||
e = NXT*i - e;
|
||||
w = A[e];
|
||||
z = w * z; /* 2**-e * ( 1 + (2**Hb-1) ) */
|
||||
z = z + w;
|
||||
z = scalbnl(z, i); /* multiply by integer power of 2 */
|
||||
|
||||
if (nflg)
|
||||
z = -z;
|
||||
return z;
|
||||
if (nflg)
|
||||
z = -z;
|
||||
return z;
|
||||
}
|
||||
|
||||
|
||||
/* Find a multiple of 1/NXT that is within 1/NXT of x. */
|
||||
static long double reducl(long double x)
|
||||
{
|
||||
long double t;
|
||||
long double t;
|
||||
|
||||
t = x * NXT;
|
||||
t = floorl(t);
|
||||
t = t / NXT;
|
||||
return t;
|
||||
t = x * NXT;
|
||||
t = floorl(t);
|
||||
t = t / NXT;
|
||||
return t;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -551,66 +551,66 @@ static long double reducl(long double x)
|
|||
|
||||
static long double powil(long double x, int nn)
|
||||
{
|
||||
long double ww, y;
|
||||
long double s;
|
||||
int n, e, sign, lx;
|
||||
long double ww, y;
|
||||
long double s;
|
||||
int n, e, sign, lx;
|
||||
|
||||
if (nn == 0)
|
||||
return 1.0;
|
||||
if (nn == 0)
|
||||
return 1.0;
|
||||
|
||||
if (nn < 0) {
|
||||
sign = -1;
|
||||
n = -nn;
|
||||
} else {
|
||||
sign = 1;
|
||||
n = nn;
|
||||
}
|
||||
if (nn < 0) {
|
||||
sign = -1;
|
||||
n = -nn;
|
||||
} else {
|
||||
sign = 1;
|
||||
n = nn;
|
||||
}
|
||||
|
||||
/* Overflow detection */
|
||||
/* Overflow detection */
|
||||
|
||||
/* Calculate approximate logarithm of answer */
|
||||
s = x;
|
||||
s = frexpl( s, &lx);
|
||||
e = (lx - 1)*n;
|
||||
if ((e == 0) || (e > 64) || (e < -64)) {
|
||||
s = (s - 7.0710678118654752e-1L) / (s + 7.0710678118654752e-1L);
|
||||
s = (2.9142135623730950L * s - 0.5 + lx) * nn * LOGE2L;
|
||||
} else {
|
||||
s = LOGE2L * e;
|
||||
}
|
||||
/* Calculate approximate logarithm of answer */
|
||||
s = x;
|
||||
s = frexpl( s, &lx);
|
||||
e = (lx - 1)*n;
|
||||
if ((e == 0) || (e > 64) || (e < -64)) {
|
||||
s = (s - 7.0710678118654752e-1L) / (s + 7.0710678118654752e-1L);
|
||||
s = (2.9142135623730950L * s - 0.5 + lx) * nn * LOGE2L;
|
||||
} else {
|
||||
s = LOGE2L * e;
|
||||
}
|
||||
|
||||
if (s > MAXLOGL)
|
||||
return huge * huge; /* overflow */
|
||||
if (s > MAXLOGL)
|
||||
return huge * huge; /* overflow */
|
||||
|
||||
if (s < MINLOGL)
|
||||
return twom10000 * twom10000; /* underflow */
|
||||
/* Handle tiny denormal answer, but with less accuracy
|
||||
* since roundoff error in 1.0/x will be amplified.
|
||||
* The precise demarcation should be the gradual underflow threshold.
|
||||
*/
|
||||
if (s < -MAXLOGL+2.0) {
|
||||
x = 1.0/x;
|
||||
sign = -sign;
|
||||
}
|
||||
if (s < MINLOGL)
|
||||
return twom10000 * twom10000; /* underflow */
|
||||
/* Handle tiny denormal answer, but with less accuracy
|
||||
* since roundoff error in 1.0/x will be amplified.
|
||||
* The precise demarcation should be the gradual underflow threshold.
|
||||
*/
|
||||
if (s < -MAXLOGL+2.0) {
|
||||
x = 1.0/x;
|
||||
sign = -sign;
|
||||
}
|
||||
|
||||
/* First bit of the power */
|
||||
if (n & 1)
|
||||
y = x;
|
||||
else
|
||||
y = 1.0;
|
||||
/* First bit of the power */
|
||||
if (n & 1)
|
||||
y = x;
|
||||
else
|
||||
y = 1.0;
|
||||
|
||||
ww = x;
|
||||
n >>= 1;
|
||||
while (n) {
|
||||
ww = ww * ww; /* arg to the 2-to-the-kth power */
|
||||
if (n & 1) /* if that bit is set, then include in product */
|
||||
y *= ww;
|
||||
n >>= 1;
|
||||
}
|
||||
ww = x;
|
||||
n >>= 1;
|
||||
while (n) {
|
||||
ww = ww * ww; /* arg to the 2-to-the-kth power */
|
||||
if (n & 1) /* if that bit is set, then include in product */
|
||||
y *= ww;
|
||||
n >>= 1;
|
||||
}
|
||||
|
||||
if (sign < 0)
|
||||
y = 1.0/y;
|
||||
return y;
|
||||
if (sign < 0)
|
||||
y = 1.0/y;
|
||||
return y;
|
||||
}
|
||||
|
||||
#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384
|
||||
|
@ -649,35 +649,35 @@ Copyright (c) 2008 Stephen L. Moshier <steve@moshier.net>\"");
|
|||
|
||||
/* powl(x,y) return x**y
|
||||
*
|
||||
* n
|
||||
* n
|
||||
* Method: Let x = 2 * (1+f)
|
||||
* 1. Compute and return log2(x) in two pieces:
|
||||
* log2(x) = w1 + w2,
|
||||
* where w1 has 113-53 = 60 bit trailing zeros.
|
||||
* 2. Perform y*log2(x) = n+y' by simulating multi-precision
|
||||
* arithmetic, where |y'|<=0.5.
|
||||
* 3. Return x**y = 2**n*exp(y'*log2)
|
||||
* 1. Compute and return log2(x) in two pieces:
|
||||
* log2(x) = w1 + w2,
|
||||
* where w1 has 113-53 = 60 bit trailing zeros.
|
||||
* 2. Perform y*log2(x) = n+y' by simulating multi-precision
|
||||
* arithmetic, where |y'|<=0.5.
|
||||
* 3. Return x**y = 2**n*exp(y'*log2)
|
||||
*
|
||||
* Special cases:
|
||||
* 1. (anything) ** 0 is 1
|
||||
* 2. (anything) ** 1 is itself
|
||||
* 3. (anything) ** NAN is NAN
|
||||
* 4. NAN ** (anything except 0) is NAN
|
||||
* 5. +-(|x| > 1) ** +INF is +INF
|
||||
* 6. +-(|x| > 1) ** -INF is +0
|
||||
* 7. +-(|x| < 1) ** +INF is +0
|
||||
* 8. +-(|x| < 1) ** -INF is +INF
|
||||
* 9. +-1 ** +-INF is NAN
|
||||
* 10. +0 ** (+anything except 0, NAN) is +0
|
||||
* 11. -0 ** (+anything except 0, NAN, odd integer) is +0
|
||||
* 12. +0 ** (-anything except 0, NAN) is +INF
|
||||
* 13. -0 ** (-anything except 0, NAN, odd integer) is +INF
|
||||
* 14. -0 ** (odd integer) = -( +0 ** (odd integer) )
|
||||
* 15. +INF ** (+anything except 0,NAN) is +INF
|
||||
* 16. +INF ** (-anything except 0,NAN) is +0
|
||||
* 17. -INF ** (anything) = -0 ** (-anything)
|
||||
* 18. (-anything) ** (integer) is (-1)**(integer)*(+anything**integer)
|
||||
* 19. (-anything except 0 and inf) ** (non-integer) is NAN
|
||||
* 1. (anything) ** 0 is 1
|
||||
* 2. (anything) ** 1 is itself
|
||||
* 3. (anything) ** NAN is NAN
|
||||
* 4. NAN ** (anything except 0) is NAN
|
||||
* 5. +-(|x| > 1) ** +INF is +INF
|
||||
* 6. +-(|x| > 1) ** -INF is +0
|
||||
* 7. +-(|x| < 1) ** +INF is +0
|
||||
* 8. +-(|x| < 1) ** -INF is +INF
|
||||
* 9. +-1 ** +-INF is NAN
|
||||
* 10. +0 ** (+anything except 0, NAN) is +0
|
||||
* 11. -0 ** (+anything except 0, NAN, odd integer) is +0
|
||||
* 12. +0 ** (-anything except 0, NAN) is +INF
|
||||
* 13. -0 ** (-anything except 0, NAN, odd integer) is +INF
|
||||
* 14. -0 ** (odd integer) = -( +0 ** (odd integer) )
|
||||
* 15. +INF ** (+anything except 0,NAN) is +INF
|
||||
* 16. +INF ** (-anything except 0,NAN) is +0
|
||||
* 17. -INF ** (anything) = -0 ** (-anything)
|
||||
* 18. (-anything) ** (integer) is (-1)**(integer)*(+anything**integer)
|
||||
* 19. (-anything except 0 and inf) ** (non-integer) is NAN
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -792,10 +792,10 @@ powl(long double x, long double y)
|
|||
/* +-NaN return x+y */
|
||||
if ((ix > 0x7fff0000)
|
||||
|| ((ix == 0x7fff0000)
|
||||
&& ((p.parts32.mswlo | p.parts32.lswhi | p.parts32.lswlo) != 0))
|
||||
&& ((p.parts32.mswlo | p.parts32.lswhi | p.parts32.lswlo) != 0))
|
||||
|| (iy > 0x7fff0000)
|
||||
|| ((iy == 0x7fff0000)
|
||||
&& ((q.parts32.mswlo | q.parts32.lswhi | q.parts32.lswlo) != 0)))
|
||||
&& ((q.parts32.mswlo | q.parts32.lswhi | q.parts32.lswlo) != 0)))
|
||||
return nan_mix(x, y);
|
||||
|
||||
/* determine if y is an odd int when x < 0
|
||||
|
@ -806,48 +806,48 @@ powl(long double x, long double y)
|
|||
yisint = 0;
|
||||
if (hx < 0)
|
||||
{
|
||||
if (iy >= 0x40700000) /* 2^113 */
|
||||
yisint = 2; /* even integer y */
|
||||
else if (iy >= 0x3fff0000) /* 1.0 */
|
||||
{
|
||||
if (floorl (y) == y)
|
||||
{
|
||||
z = 0.5 * y;
|
||||
if (floorl (z) == z)
|
||||
yisint = 2;
|
||||
else
|
||||
yisint = 1;
|
||||
}
|
||||
}
|
||||
if (iy >= 0x40700000) /* 2^113 */
|
||||
yisint = 2; /* even integer y */
|
||||
else if (iy >= 0x3fff0000) /* 1.0 */
|
||||
{
|
||||
if (floorl (y) == y)
|
||||
{
|
||||
z = 0.5 * y;
|
||||
if (floorl (z) == z)
|
||||
yisint = 2;
|
||||
else
|
||||
yisint = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* special value of y */
|
||||
if ((q.parts32.mswlo | q.parts32.lswhi | q.parts32.lswlo) == 0)
|
||||
{
|
||||
if (iy == 0x7fff0000) /* y is +-inf */
|
||||
{
|
||||
if (((ix - 0x3fff0000) | p.parts32.mswlo | p.parts32.lswhi |
|
||||
p.parts32.lswlo) == 0)
|
||||
return y - y; /* +-1**inf is NaN */
|
||||
else if (ix >= 0x3fff0000) /* (|x|>1)**+-inf = inf,0 */
|
||||
return (hy >= 0) ? y : zero;
|
||||
else /* (|x|<1)**-,+inf = inf,0 */
|
||||
return (hy < 0) ? -y : zero;
|
||||
}
|
||||
if (iy == 0x7fff0000) /* y is +-inf */
|
||||
{
|
||||
if (((ix - 0x3fff0000) | p.parts32.mswlo | p.parts32.lswhi |
|
||||
p.parts32.lswlo) == 0)
|
||||
return y - y; /* +-1**inf is NaN */
|
||||
else if (ix >= 0x3fff0000) /* (|x|>1)**+-inf = inf,0 */
|
||||
return (hy >= 0) ? y : zero;
|
||||
else /* (|x|<1)**-,+inf = inf,0 */
|
||||
return (hy < 0) ? -y : zero;
|
||||
}
|
||||
if (iy == 0x3fff0000)
|
||||
{ /* y is +-1 */
|
||||
if (hy < 0)
|
||||
return one / x;
|
||||
else
|
||||
return x;
|
||||
}
|
||||
{ /* y is +-1 */
|
||||
if (hy < 0)
|
||||
return one / x;
|
||||
else
|
||||
return x;
|
||||
}
|
||||
if (hy == 0x40000000)
|
||||
return x * x; /* y is 2 */
|
||||
return x * x; /* y is 2 */
|
||||
if (hy == 0x3ffe0000)
|
||||
{ /* y is 0.5 */
|
||||
if (hx >= 0) /* x >= +0 */
|
||||
return sqrtl (x);
|
||||
}
|
||||
{ /* y is 0.5 */
|
||||
if (hx >= 0) /* x >= +0 */
|
||||
return sqrtl (x);
|
||||
}
|
||||
}
|
||||
|
||||
ax = fabsl (x);
|
||||
|
@ -855,21 +855,21 @@ powl(long double x, long double y)
|
|||
if ((p.parts32.mswlo | p.parts32.lswhi | p.parts32.lswlo) == 0)
|
||||
{
|
||||
if (ix == 0x7fff0000 || ix == 0 || ix == 0x3fff0000)
|
||||
{
|
||||
z = ax; /*x is +-0,+-inf,+-1 */
|
||||
if (hy < 0)
|
||||
z = one / z; /* z = (1/|x|) */
|
||||
if (hx < 0)
|
||||
{
|
||||
if (((ix - 0x3fff0000) | yisint) == 0)
|
||||
{
|
||||
z = (z - z) / (z - z); /* (-1)**non-int is NaN */
|
||||
}
|
||||
else if (yisint == 1)
|
||||
z = -z; /* (x<0)**odd = -(|x|**odd) */
|
||||
}
|
||||
return z;
|
||||
}
|
||||
{
|
||||
z = ax; /*x is +-0,+-inf,+-1 */
|
||||
if (hy < 0)
|
||||
z = one / z; /* z = (1/|x|) */
|
||||
if (hx < 0)
|
||||
{
|
||||
if (((ix - 0x3fff0000) | yisint) == 0)
|
||||
{
|
||||
z = (z - z) / (z - z); /* (-1)**non-int is NaN */
|
||||
}
|
||||
else if (yisint == 1)
|
||||
z = -z; /* (x<0)**odd = -(|x|**odd) */
|
||||
}
|
||||
return z;
|
||||
}
|
||||
}
|
||||
|
||||
/* (x<0)**(non-int) is NaN */
|
||||
|
@ -883,17 +883,17 @@ powl(long double x, long double y)
|
|||
{
|
||||
/* if (1 - 2^-113)^y underflows, y > 1.1873e38 */
|
||||
if (iy > 0x407d654b)
|
||||
{
|
||||
if (ix <= 0x3ffeffff)
|
||||
return (hy < 0) ? huge * huge : tiny * tiny;
|
||||
if (ix >= 0x3fff0000)
|
||||
return (hy > 0) ? huge * huge : tiny * tiny;
|
||||
}
|
||||
{
|
||||
if (ix <= 0x3ffeffff)
|
||||
return (hy < 0) ? huge * huge : tiny * tiny;
|
||||
if (ix >= 0x3fff0000)
|
||||
return (hy > 0) ? huge * huge : tiny * tiny;
|
||||
}
|
||||
/* over/underflow if x is not close to one */
|
||||
if (ix < 0x3ffeffff)
|
||||
return (hy < 0) ? huge * huge : tiny * tiny;
|
||||
return (hy < 0) ? huge * huge : tiny * tiny;
|
||||
if (ix > 0x3fff0000)
|
||||
return (hy > 0) ? huge * huge : tiny * tiny;
|
||||
return (hy > 0) ? huge * huge : tiny * tiny;
|
||||
}
|
||||
|
||||
n = 0;
|
||||
|
@ -908,11 +908,11 @@ powl(long double x, long double y)
|
|||
n += ((ix) >> 16) - 0x3fff;
|
||||
j = ix & 0x0000ffff;
|
||||
/* determine interval */
|
||||
ix = j | 0x3fff0000; /* normalize ix */
|
||||
ix = j | 0x3fff0000; /* normalize ix */
|
||||
if (j <= 0x3988)
|
||||
k = 0; /* |x|<sqrt(3/2) */
|
||||
k = 0; /* |x|<sqrt(3/2) */
|
||||
else if (j < 0xbb67)
|
||||
k = 1; /* |x|<sqrt(3) */
|
||||
k = 1; /* |x|<sqrt(3) */
|
||||
else
|
||||
{
|
||||
k = 0;
|
||||
|
@ -925,7 +925,7 @@ powl(long double x, long double y)
|
|||
ax = o.value;
|
||||
|
||||
/* compute s = s_h+s_l = (x-1)/(x+1) or (x-1.5)/(x+1.5) */
|
||||
u = ax - bp[k]; /* bp[0]=1.0, bp[1]=1.5 */
|
||||
u = ax - bp[k]; /* bp[0]=1.0, bp[1]=1.5 */
|
||||
v = one / (ax + bp[k]);
|
||||
s = u * v;
|
||||
s_h = s;
|
||||
|
@ -965,7 +965,7 @@ powl(long double x, long double y)
|
|||
o.parts32.lswhi &= 0xf8000000;
|
||||
p_h = o.value;
|
||||
p_l = v - (p_h - u);
|
||||
z_h = cp_h * p_h; /* cp_h+cp_l = 2/(3*log2) */
|
||||
z_h = cp_h * p_h; /* cp_h+cp_l = 2/(3*log2) */
|
||||
z_l = cp_l * p_h + p_l * cp + dp_l[k];
|
||||
/* log2(ax) = (s+..)*2/(3*log2) = n + dp_h + z_h + z_l */
|
||||
t = (long double) n;
|
||||
|
@ -979,7 +979,7 @@ powl(long double x, long double y)
|
|||
/* s (sign of result -ve**odd) = -1 else = 1 */
|
||||
s = one;
|
||||
if (((((uint32_t) hx >> 31) - 1) | (yisint - 1)) == 0)
|
||||
s = -one; /* (-ve)**(odd int) */
|
||||
s = -one; /* (-ve)**(odd int) */
|
||||
|
||||
/* split up y into yy1+y2 and compute (yy1+y2)*(t1+t2) */
|
||||
yy1 = y;
|
||||
|
@ -996,33 +996,33 @@ powl(long double x, long double y)
|
|||
{
|
||||
/* if z > 16384 */
|
||||
if (((j - 0x400d0000) | o.parts32.mswlo | o.parts32.lswhi |
|
||||
o.parts32.lswlo) != 0)
|
||||
return s * huge * huge; /* overflow */
|
||||
o.parts32.lswlo) != 0)
|
||||
return s * huge * huge; /* overflow */
|
||||
else
|
||||
{
|
||||
if (p_l + ovt > z - p_h)
|
||||
return s * huge * huge; /* overflow */
|
||||
}
|
||||
{
|
||||
if (p_l + ovt > z - p_h)
|
||||
return s * huge * huge; /* overflow */
|
||||
}
|
||||
}
|
||||
else if ((j & 0x7fffffff) >= 0x400d01b9) /* z <= -16495 */
|
||||
else if ((j & 0x7fffffff) >= 0x400d01b9) /* z <= -16495 */
|
||||
{
|
||||
/* z < -16495 */
|
||||
if (((j - 0xc00d01bc) | o.parts32.mswlo | o.parts32.lswhi |
|
||||
o.parts32.lswlo)
|
||||
!= 0)
|
||||
return s * tiny * tiny; /* underflow */
|
||||
o.parts32.lswlo)
|
||||
!= 0)
|
||||
return s * tiny * tiny; /* underflow */
|
||||
else
|
||||
{
|
||||
if (p_l <= z - p_h)
|
||||
return s * tiny * tiny; /* underflow */
|
||||
}
|
||||
{
|
||||
if (p_l <= z - p_h)
|
||||
return s * tiny * tiny; /* underflow */
|
||||
}
|
||||
}
|
||||
/* compute 2**(p_h+p_l) */
|
||||
i = j & 0x7fffffff;
|
||||
k = (i >> 16) - 0x3fff;
|
||||
n = 0;
|
||||
if (i > 0x3ffe0000)
|
||||
{ /* if |z| > 0.5, set n = [z+0.5] */
|
||||
{ /* if |z| > 0.5, set n = [z+0.5] */
|
||||
n = floorl (z + 0.5L);
|
||||
t = n;
|
||||
p_h -= t;
|
||||
|
@ -1047,7 +1047,7 @@ powl(long double x, long double y)
|
|||
j = o.parts32.mswhi;
|
||||
j += (n << 16);
|
||||
if ((j >> 16) <= 0)
|
||||
z = scalbnl (z, n); /* subnormal output */
|
||||
z = scalbnl (z, n); /* subnormal output */
|
||||
else
|
||||
{
|
||||
o.parts32.mswhi = j;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
||||
│ vi: set et ft=c ts=8 sts=2 sw=2 fenc=utf-8 :vi │
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2023 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
|
@ -34,41 +34,41 @@ static const float zero = 0.0;
|
|||
float
|
||||
remainderf2(float x, float p)
|
||||
{
|
||||
int32_t hx,hp;
|
||||
uint32_t sx;
|
||||
float p_half;
|
||||
int32_t hx,hp;
|
||||
uint32_t sx;
|
||||
float p_half;
|
||||
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
GET_FLOAT_WORD(hp,p);
|
||||
sx = hx&0x80000000;
|
||||
hp &= 0x7fffffff;
|
||||
hx &= 0x7fffffff;
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
GET_FLOAT_WORD(hp,p);
|
||||
sx = hx&0x80000000;
|
||||
hp &= 0x7fffffff;
|
||||
hx &= 0x7fffffff;
|
||||
|
||||
/* purge off exception values */
|
||||
if((hp==0)|| /* p = 0 */
|
||||
(hx>=0x7f800000)|| /* x not finite */
|
||||
((hp>0x7f800000))) /* p is NaN */
|
||||
return nan_mix_op(x, p, *)/nan_mix_op(x, p, *);
|
||||
/* purge off exception values */
|
||||
if((hp==0)|| /* p = 0 */
|
||||
(hx>=0x7f800000)|| /* x not finite */
|
||||
((hp>0x7f800000))) /* p is NaN */
|
||||
return nan_mix_op(x, p, *)/nan_mix_op(x, p, *);
|
||||
|
||||
|
||||
if (hp<=0x7effffff) x = fmodf(x,p+p); /* now x < 2p */
|
||||
if ((hx-hp)==0) return zero*x;
|
||||
x = fabsf(x);
|
||||
p = fabsf(p);
|
||||
if (hp<0x01000000) {
|
||||
if(x+x>p) {
|
||||
x-=p;
|
||||
if(x+x>=p) x -= p;
|
||||
}
|
||||
} else {
|
||||
p_half = (float)0.5*p;
|
||||
if(x>p_half) {
|
||||
x-=p;
|
||||
if(x>=p_half) x -= p;
|
||||
}
|
||||
}
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
if ((hx&0x7fffffff)==0) hx = 0;
|
||||
SET_FLOAT_WORD(x,hx^sx);
|
||||
return x;
|
||||
if (hp<=0x7effffff) x = fmodf(x,p+p); /* now x < 2p */
|
||||
if ((hx-hp)==0) return zero*x;
|
||||
x = fabsf(x);
|
||||
p = fabsf(p);
|
||||
if (hp<0x01000000) {
|
||||
if(x+x>p) {
|
||||
x-=p;
|
||||
if(x+x>=p) x -= p;
|
||||
}
|
||||
} else {
|
||||
p_half = (float)0.5*p;
|
||||
if(x>p_half) {
|
||||
x-=p;
|
||||
if(x>=p_half) x -= p;
|
||||
}
|
||||
}
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
if ((hx&0x7fffffff)==0) hx = 0;
|
||||
SET_FLOAT_WORD(x,hx^sx);
|
||||
return x;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
||||
│ vi: set et ft=c ts=8 sts=2 sw=2 fenc=utf-8 :vi │
|
||||
╚──────────────────────────────────────────────────────────────────────────────╝
|
||||
│ │
|
||||
│ Optimized Routines │
|
||||
|
@ -52,14 +52,14 @@ sincosf (float y, float *sinp, float *cosp)
|
|||
double x2 = x * x;
|
||||
|
||||
if (UNLIKELY (abstop12 (y) < abstop12 (0x1p-12f)))
|
||||
{
|
||||
if (UNLIKELY (abstop12 (y) < abstop12 (0x1p-126f)))
|
||||
/* Force underflow for tiny y. */
|
||||
FORCE_EVAL (x2);
|
||||
*sinp = y;
|
||||
*cosp = 1.0f;
|
||||
return;
|
||||
}
|
||||
{
|
||||
if (UNLIKELY (abstop12 (y) < abstop12 (0x1p-126f)))
|
||||
/* Force underflow for tiny y. */
|
||||
FORCE_EVAL (x2);
|
||||
*sinp = y;
|
||||
*cosp = 1.0f;
|
||||
return;
|
||||
}
|
||||
|
||||
sincosf_poly (x, x2, p, 0, sinp, cosp);
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ sincosf (float y, float *sinp, float *cosp)
|
|||
s = p->sign[n & 3];
|
||||
|
||||
if (n & 2)
|
||||
p = &__sincosf_table[1];
|
||||
p = &__sincosf_table[1];
|
||||
|
||||
sincosf_poly (x * s, x * x, p, n, sinp, cosp);
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ sincosf (float y, float *sinp, float *cosp)
|
|||
s = p->sign[(n + sign) & 3];
|
||||
|
||||
if ((n + sign) & 2)
|
||||
p = &__sincosf_table[1];
|
||||
p = &__sincosf_table[1];
|
||||
|
||||
sincosf_poly (x * s, x * x, p, n, sinp, cosp);
|
||||
}
|
||||
|
@ -96,8 +96,8 @@ sincosf (float y, float *sinp, float *cosp)
|
|||
*sinp = *cosp = y - y;
|
||||
#if WANT_ERRNO
|
||||
/* Needed to set errno for +-Inf, the add is a hack to work
|
||||
around a gcc register allocation issue: just passing y
|
||||
affects code generation in the fast path. */
|
||||
around a gcc register allocation issue: just passing y
|
||||
affects code generation in the fast path. */
|
||||
__math_invalidf (y + y);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
||||
│ vi: set et ft=c ts=8 sts=2 sw=2 fenc=utf-8 :vi │
|
||||
╚──────────────────────────────────────────────────────────────────────────────╝
|
||||
│ │
|
||||
│ Optimized Routines │
|
||||
|
@ -77,7 +77,7 @@ const sincos_t __sincosf_table[2] =
|
|||
only 8 new bits are added per entry, making the table 4 times larger. */
|
||||
const uint32_t __inv_pio4[24] =
|
||||
{
|
||||
0xa2, 0xa2f9, 0xa2f983, 0xa2f9836e,
|
||||
0xa2, 0xa2f9, 0xa2f983, 0xa2f9836e,
|
||||
0xf9836e4e, 0x836e4e44, 0x6e4e4415, 0x4e441529,
|
||||
0x441529fc, 0x1529fc27, 0x29fc2757, 0xfc2757d1,
|
||||
0x2757d1f5, 0x57d1f534, 0xd1f534dd, 0xf534ddc0,
|
||||
|
|
|
@ -18,27 +18,27 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "net/http/escape.h"
|
||||
|
||||
// generated by:
|
||||
// o//tool/build/xlat.com -DUL '_.!~*'"'"'();&=+$,-' -iskEscapeAuthority
|
||||
// generated by:
|
||||
// o//tool/build/xlat.com -DUL '_.!~*'"'"'();&=+$,-' -iskEscapeAuthority
|
||||
//
|
||||
// present absent
|
||||
// ──────────────── ────────────────
|
||||
// ∅☺☻♥♦♣♠•◘○◙♂♀♪♫☼ 0x00
|
||||
// ►◄↕‼¶§▬↨↑↓→←∟↔▲▼ 0x10
|
||||
// ␠ “# % / ! $ &‘()*+,-. 0x20
|
||||
// : < >⁇ 0123456789 ; = 0x30
|
||||
// @ ABCDEFGHIJKLMNO 0x40
|
||||
// [⭝]^ PQRSTUVWXYZ _ 0x50
|
||||
// ` abcdefghijklmno 0x60
|
||||
// {|} ⌂ pqrstuvwxyz ~ 0x70
|
||||
// ÇüéâäàåçêëèïîìÄÅ 0x80
|
||||
// ÉæÆôöòûùÿÖÜ¢£¥€ƒ 0x90
|
||||
// áíóúñѪº¿⌐¬½¼¡«» 0xa0
|
||||
// ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐ 0xb0
|
||||
// └┴┬├─┼╞╟╚╔╩╦╠═╬╧ 0xc0
|
||||
// ╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ 0xd0
|
||||
// αßΓπΣσμτΦΘΩδ∞φε∩ 0xe0
|
||||
// ≡±≥≤⌠⌡÷≈°∙×√ⁿ²■λ 0xf0
|
||||
// present absent
|
||||
// ──────────────── ────────────────
|
||||
// ∅☺☻♥♦♣♠•◘○◙♂♀♪♫☼ 0x00
|
||||
// ►◄↕‼¶§▬↨↑↓→←∟↔▲▼ 0x10
|
||||
// ␠ “# % / ! $ &‘()*+,-. 0x20
|
||||
// : < >⁇ 0123456789 ; = 0x30
|
||||
// @ ABCDEFGHIJKLMNO 0x40
|
||||
// [⭝]^ PQRSTUVWXYZ _ 0x50
|
||||
// ` abcdefghijklmno 0x60
|
||||
// {|} ⌂ pqrstuvwxyz ~ 0x70
|
||||
// ÇüéâäàåçêëèïîìÄÅ 0x80
|
||||
// ÉæÆôöòûùÿÖÜ¢£¥€ƒ 0x90
|
||||
// áíóúñѪº¿⌐¬½¼¡«» 0xa0
|
||||
// ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐ 0xb0
|
||||
// └┴┬├─┼╞╟╚╔╩╦╠═╬╧ 0xc0
|
||||
// ╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ 0xd0
|
||||
// αßΓπΣσμτΦΘΩδ∞φε∩ 0xe0
|
||||
// ≡±≥≤⌠⌡÷≈°∙×√ⁿ²■λ 0xf0
|
||||
|
||||
const char kEscapeAuthority[256] = {
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x00
|
||||
|
|
|
@ -18,27 +18,27 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "net/http/escape.h"
|
||||
|
||||
// generated by:
|
||||
// o//tool/build/xlat.com -DUL '/?.~_@:!$&'"'"'()*+,;=-' -iskEscapeFragment
|
||||
// generated by:
|
||||
// o//tool/build/xlat.com -DUL '/?.~_@:!$&'"'"'()*+,;=-' -iskEscapeFragment
|
||||
//
|
||||
// present absent
|
||||
// ──────────────── ────────────────
|
||||
// ∅☺☻♥♦♣♠•◘○◙♂♀♪♫☼ 0x00
|
||||
// ►◄↕‼¶§▬↨↑↓→←∟↔▲▼ 0x10
|
||||
// ␠ “# % ! § &‘()*+,-./ 0x20
|
||||
// < > 0123456789:; = ⁇ 0x30
|
||||
// @ABCDEFGHIJKLMNO 0x40
|
||||
// [⭝]^ PQRSTUVWXYZ _ 0x50
|
||||
// ` abcdefghijklmno 0x60
|
||||
// {|} ⌂ pqrstuvwxyz ~ 0x70
|
||||
// ÇüéâäàåçêëèïîìÄÅ 0x80
|
||||
// ÉæÆôöòûùÿÖÜ¢£¥€ƒ 0x90
|
||||
// áíóúñѪº¿⌐¬½¼¡«» 0xa0
|
||||
// ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐ 0xb0
|
||||
// └┴┬├─┼╞╟╚╔╩╦╠═╬╧ 0xc0
|
||||
// ╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ 0xd0
|
||||
// αßΓπΣσμτΦΘΩδ∞φε∩ 0xe0
|
||||
// ≡±≥≤⌠⌡÷≈°∙×√ⁿ²■λ 0xf0
|
||||
// present absent
|
||||
// ──────────────── ────────────────
|
||||
// ∅☺☻♥♦♣♠•◘○◙♂♀♪♫☼ 0x00
|
||||
// ►◄↕‼¶§▬↨↑↓→←∟↔▲▼ 0x10
|
||||
// ␠ “# % ! § &‘()*+,-./ 0x20
|
||||
// < > 0123456789:; = ⁇ 0x30
|
||||
// @ABCDEFGHIJKLMNO 0x40
|
||||
// [⭝]^ PQRSTUVWXYZ _ 0x50
|
||||
// ` abcdefghijklmno 0x60
|
||||
// {|} ⌂ pqrstuvwxyz ~ 0x70
|
||||
// ÇüéâäàåçêëèïîìÄÅ 0x80
|
||||
// ÉæÆôöòûùÿÖÜ¢£¥€ƒ 0x90
|
||||
// áíóúñѪº¿⌐¬½¼¡«» 0xa0
|
||||
// ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐ 0xb0
|
||||
// └┴┬├─┼╞╟╚╔╩╦╠═╬╧ 0xc0
|
||||
// ╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ 0xd0
|
||||
// αßΓπΣσμτΦΘΩδ∞φε∩ 0xe0
|
||||
// ≡±≥≤⌠⌡÷≈°∙×√ⁿ²■λ 0xf0
|
||||
|
||||
const char kEscapeFragment[256] = {
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x00
|
||||
|
|
|
@ -18,27 +18,27 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "net/http/escape.h"
|
||||
|
||||
// generated by:
|
||||
// o//tool/build/xlat.com -DUL '_-.!~*'"'"'();&=+$,:' -iskEscapeIp
|
||||
// generated by:
|
||||
// o//tool/build/xlat.com -DUL '_-.!~*'"'"'();&=+$,:' -iskEscapeIp
|
||||
//
|
||||
// present absent
|
||||
// ──────────────── ────────────────
|
||||
// ∅☺☻♥♦♣♠•◘○◙♂♀♪♫☼ 0x00
|
||||
// ►◄↕‼¶§▬↨↑↓→←∟↔▲▼ 0x10
|
||||
// ␠ “# % / ! § &‘()*+,-. 0x20
|
||||
// < >⁇ 0123456789:; = 0x30
|
||||
// @ ABCDEFGHIJKLMNO 0x40
|
||||
// [⭝]^ PQRSTUVWXYZ _ 0x50
|
||||
// ` abcdefghijklmno 0x60
|
||||
// {|} ⌂ pqrstuvwxyz ~ 0x70
|
||||
// ÇüéâäàåçêëèïîìÄÅ 0x80
|
||||
// ÉæÆôöòûùÿÖÜ¢£¥€ƒ 0x90
|
||||
// áíóúñѪº¿⌐¬½¼¡«» 0xa0
|
||||
// ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐ 0xb0
|
||||
// └┴┬├─┼╞╟╚╔╩╦╠═╬╧ 0xc0
|
||||
// ╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ 0xd0
|
||||
// αßΓπΣσμτΦΘΩδ∞φε∩ 0xe0
|
||||
// ≡±≥≤⌠⌡÷≈°∙×√ⁿ²■λ 0xf0
|
||||
// present absent
|
||||
// ──────────────── ────────────────
|
||||
// ∅☺☻♥♦♣♠•◘○◙♂♀♪♫☼ 0x00
|
||||
// ►◄↕‼¶§▬↨↑↓→←∟↔▲▼ 0x10
|
||||
// ␠ “# % / ! § &‘()*+,-. 0x20
|
||||
// < >⁇ 0123456789:; = 0x30
|
||||
// @ ABCDEFGHIJKLMNO 0x40
|
||||
// [⭝]^ PQRSTUVWXYZ _ 0x50
|
||||
// ` abcdefghijklmno 0x60
|
||||
// {|} ⌂ pqrstuvwxyz ~ 0x70
|
||||
// ÇüéâäàåçêëèïîìÄÅ 0x80
|
||||
// ÉæÆôöòûùÿÖÜ¢£¥€ƒ 0x90
|
||||
// áíóúñѪº¿⌐¬½¼¡«» 0xa0
|
||||
// ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐ 0xb0
|
||||
// └┴┬├─┼╞╟╚╔╩╦╠═╬╧ 0xc0
|
||||
// ╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ 0xd0
|
||||
// αßΓπΣσμτΦΘΩδ∞φε∩ 0xe0
|
||||
// ≡±≥≤⌠⌡÷≈°∙×√ⁿ²■λ 0xf0
|
||||
|
||||
const char kEscapeIp[256] = {
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x00
|
||||
|
|
|
@ -18,27 +18,27 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "net/http/escape.h"
|
||||
|
||||
// generated by:
|
||||
// o//tool/build/xlat.com -DUL '.-*_' -iskEscapeParam
|
||||
// generated by:
|
||||
// o//tool/build/xlat.com -DUL '.-*_' -iskEscapeParam
|
||||
//
|
||||
// present absent
|
||||
// ──────────────── ────────────────
|
||||
// ∅☺☻♥♦♣♠•◘○◙♂♀♪♫☼ 0x00
|
||||
// ►◄↕‼¶§▬↨↑↓→←∟↔▲▼ 0x10
|
||||
// ␠!“#§%&‘() +, / * -. 0x20
|
||||
// :;<=>⁇ 0123456789 0x30
|
||||
// @ ABCDEFGHIJKLMNO 0x40
|
||||
// [⭝]^ PQRSTUVWXYZ _ 0x50
|
||||
// ` abcdefghijklmno 0x60
|
||||
// {|}~⌂ pqrstuvwxyz 0x70
|
||||
// ÇüéâäàåçêëèïîìÄÅ 0x80
|
||||
// ÉæÆôöòûùÿÖÜ¢£¥€ƒ 0x90
|
||||
// áíóúñѪº¿⌐¬½¼¡«» 0xa0
|
||||
// ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐ 0xb0
|
||||
// └┴┬├─┼╞╟╚╔╩╦╠═╬╧ 0xc0
|
||||
// ╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ 0xd0
|
||||
// αßΓπΣσμτΦΘΩδ∞φε∩ 0xe0
|
||||
// ≡±≥≤⌠⌡÷≈°∙×√ⁿ²■λ 0xf0
|
||||
// present absent
|
||||
// ──────────────── ────────────────
|
||||
// ∅☺☻♥♦♣♠•◘○◙♂♀♪♫☼ 0x00
|
||||
// ►◄↕‼¶§▬↨↑↓→←∟↔▲▼ 0x10
|
||||
// ␠!“#§%&‘() +, / * -. 0x20
|
||||
// :;<=>⁇ 0123456789 0x30
|
||||
// @ ABCDEFGHIJKLMNO 0x40
|
||||
// [⭝]^ PQRSTUVWXYZ _ 0x50
|
||||
// ` abcdefghijklmno 0x60
|
||||
// {|}~⌂ pqrstuvwxyz 0x70
|
||||
// ÇüéâäàåçêëèïîìÄÅ 0x80
|
||||
// ÉæÆôöòûùÿÖÜ¢£¥€ƒ 0x90
|
||||
// áíóúñѪº¿⌐¬½¼¡«» 0xa0
|
||||
// ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐ 0xb0
|
||||
// └┴┬├─┼╞╟╚╔╩╦╠═╬╧ 0xc0
|
||||
// ╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ 0xd0
|
||||
// αßΓπΣσμτΦΘΩδ∞φε∩ 0xe0
|
||||
// ≡±≥≤⌠⌡÷≈°∙×√ⁿ²■λ 0xf0
|
||||
|
||||
const char kEscapeParam[256] = {
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x00
|
||||
|
|
|
@ -18,27 +18,27 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "net/http/escape.h"
|
||||
|
||||
// generated by:
|
||||
// o//tool/build/xlat.com -DUL '.-~_@:!$&'"'"'()*+,;=/' -iskEscapePath
|
||||
// generated by:
|
||||
// o//tool/build/xlat.com -DUL '.-~_@:!$&'"'"'()*+,;=/' -iskEscapePath
|
||||
//
|
||||
// present absent
|
||||
// ──────────────── ────────────────
|
||||
// ∅☺☻♥♦♣♠•◘○◙♂♀♪♫☼ 0x00
|
||||
// ►◄↕‼¶§▬↨↑↓→←∟↔▲▼ 0x10
|
||||
// ␠ “# % ! § &‘()*+,-./ 0x20
|
||||
// < >⁇ 0123456789:; = 0x30
|
||||
// @ABCDEFGHIJKLMNO 0x40
|
||||
// [⭝]^ PQRSTUVWXYZ _ 0x50
|
||||
// ` abcdefghijklmno 0x60
|
||||
// {|} ⌂ pqrstuvwxyz ~ 0x70
|
||||
// ÇüéâäàåçêëèïîìÄÅ 0x80
|
||||
// ÉæÆôöòûùÿÖÜ¢£¥€ƒ 0x90
|
||||
// áíóúñѪº¿⌐¬½¼¡«» 0xa0
|
||||
// ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐ 0xb0
|
||||
// └┴┬├─┼╞╟╚╔╩╦╠═╬╧ 0xc0
|
||||
// ╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ 0xd0
|
||||
// αßΓπΣσμτΦΘΩδ∞φε∩ 0xe0
|
||||
// ≡±≥≤⌠⌡÷≈°∙×√ⁿ²■λ 0xf0
|
||||
// present absent
|
||||
// ──────────────── ────────────────
|
||||
// ∅☺☻♥♦♣♠•◘○◙♂♀♪♫☼ 0x00
|
||||
// ►◄↕‼¶§▬↨↑↓→←∟↔▲▼ 0x10
|
||||
// ␠ “# % ! § &‘()*+,-./ 0x20
|
||||
// < >⁇ 0123456789:; = 0x30
|
||||
// @ABCDEFGHIJKLMNO 0x40
|
||||
// [⭝]^ PQRSTUVWXYZ _ 0x50
|
||||
// ` abcdefghijklmno 0x60
|
||||
// {|} ⌂ pqrstuvwxyz ~ 0x70
|
||||
// ÇüéâäàåçêëèïîìÄÅ 0x80
|
||||
// ÉæÆôöòûùÿÖÜ¢£¥€ƒ 0x90
|
||||
// áíóúñѪº¿⌐¬½¼¡«» 0xa0
|
||||
// ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐ 0xb0
|
||||
// └┴┬├─┼╞╟╚╔╩╦╠═╬╧ 0xc0
|
||||
// ╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ 0xd0
|
||||
// αßΓπΣσμτΦΘΩδ∞φε∩ 0xe0
|
||||
// ≡±≥≤⌠⌡÷≈°∙×√ⁿ²■λ 0xf0
|
||||
|
||||
const char kEscapePath[256] = {
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x00
|
||||
|
|
|
@ -18,27 +18,27 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "net/http/escape.h"
|
||||
|
||||
// generated by:
|
||||
// o//tool/build/xlat.com -DUL '.-~_@:!$&'"'"'()*+,;=' -iskEscapeSegment
|
||||
// generated by:
|
||||
// o//tool/build/xlat.com -DUL '.-~_@:!$&'"'"'()*+,;=' -iskEscapeSegment
|
||||
//
|
||||
// present absent
|
||||
// ──────────────── ────────────────
|
||||
// ∅☺☻♥♦♣♠•◘○◙♂♀♪♫☼ 0x00
|
||||
// ►◄↕‼¶§▬↨↑↓→←∟↔▲▼ 0x10
|
||||
// ␠ “# % / ! § &‘()*+,-. 0x20
|
||||
// < >⁇ 0123456789:; = 0x30
|
||||
// @ABCDEFGHIJKLMNO 0x40
|
||||
// [⭝]^ PQRSTUVWXYZ _ 0x50
|
||||
// ` abcdefghijklmno 0x60
|
||||
// {|} ⌂ pqrstuvwxyz ~ 0x70
|
||||
// ÇüéâäàåçêëèïîìÄÅ 0x80
|
||||
// ÉæÆôöòûùÿÖÜ¢£¥€ƒ 0x90
|
||||
// áíóúñѪº¿⌐¬½¼¡«» 0xa0
|
||||
// ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐ 0xb0
|
||||
// └┴┬├─┼╞╟╚╔╩╦╠═╬╧ 0xc0
|
||||
// ╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ 0xd0
|
||||
// αßΓπΣσμτΦΘΩδ∞φε∩ 0xe0
|
||||
// ≡±≥≤⌠⌡÷≈°∙×√ⁿ²■λ 0xf0
|
||||
// present absent
|
||||
// ──────────────── ────────────────
|
||||
// ∅☺☻♥♦♣♠•◘○◙♂♀♪♫☼ 0x00
|
||||
// ►◄↕‼¶§▬↨↑↓→←∟↔▲▼ 0x10
|
||||
// ␠ “# % / ! § &‘()*+,-. 0x20
|
||||
// < >⁇ 0123456789:; = 0x30
|
||||
// @ABCDEFGHIJKLMNO 0x40
|
||||
// [⭝]^ PQRSTUVWXYZ _ 0x50
|
||||
// ` abcdefghijklmno 0x60
|
||||
// {|} ⌂ pqrstuvwxyz ~ 0x70
|
||||
// ÇüéâäàåçêëèïîìÄÅ 0x80
|
||||
// ÉæÆôöòûùÿÖÜ¢£¥€ƒ 0x90
|
||||
// áíóúñѪº¿⌐¬½¼¡«» 0xa0
|
||||
// ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐ 0xb0
|
||||
// └┴┬├─┼╞╟╚╔╩╦╠═╬╧ 0xc0
|
||||
// ╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ 0xd0
|
||||
// αßΓπΣσμτΦΘΩδ∞φε∩ 0xe0
|
||||
// ≡±≥≤⌠⌡÷≈°∙×√ⁿ²■λ 0xf0
|
||||
|
||||
const char kEscapeSegment[256] = {
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x00
|
||||
|
|
|
@ -18,27 +18,27 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "net/http/escape.h"
|
||||
|
||||
// generated by:
|
||||
// o//tool/build/xlat.com -DA _- -skHostChars
|
||||
// generated by:
|
||||
// o//tool/build/xlat.com -DA _- -skHostChars
|
||||
//
|
||||
// present absent
|
||||
// ──────────────── ────────────────
|
||||
// ∅☺☻♥♦♣♠•◘○◙♂♀♪♫☼ 0x00
|
||||
// ►◄↕‼¶§▬↨↑↓→←∟↔▲▼ 0x10
|
||||
// - ␠!“#§%&‘()*+, ./ 0x20
|
||||
// 0123456789 :;<=>⁇ 0x30
|
||||
// ABCDEFGHIJKLMNO @ 0x40
|
||||
// PQRSTUVWXYZ _ [⭝]^ 0x50
|
||||
// abcdefghijklmno ` 0x60
|
||||
// pqrstuvwxyz {|}~⌂ 0x70
|
||||
// ÇüéâäàåçêëèïîìÄÅ 0x80
|
||||
// ÉæÆôöòûùÿÖÜ¢£¥€ƒ 0x90
|
||||
// áíóúñѪº¿⌐¬½¼¡«» 0xa0
|
||||
// ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐ 0xb0
|
||||
// └┴┬├─┼╞╟╚╔╩╦╠═╬╧ 0xc0
|
||||
// ╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ 0xd0
|
||||
// αßΓπΣσμτΦΘΩδ∞φε∩ 0xe0
|
||||
// ≡±≥≤⌠⌡÷≈°∙×√ⁿ²■λ 0xf0
|
||||
// present absent
|
||||
// ──────────────── ────────────────
|
||||
// ∅☺☻♥♦♣♠•◘○◙♂♀♪♫☼ 0x00
|
||||
// ►◄↕‼¶§▬↨↑↓→←∟↔▲▼ 0x10
|
||||
// - ␠!“#§%&‘()*+, ./ 0x20
|
||||
// 0123456789 :;<=>⁇ 0x30
|
||||
// ABCDEFGHIJKLMNO @ 0x40
|
||||
// PQRSTUVWXYZ _ [⭝]^ 0x50
|
||||
// abcdefghijklmno ` 0x60
|
||||
// pqrstuvwxyz {|}~⌂ 0x70
|
||||
// ÇüéâäàåçêëèïîìÄÅ 0x80
|
||||
// ÉæÆôöòûùÿÖÜ¢£¥€ƒ 0x90
|
||||
// áíóúñѪº¿⌐¬½¼¡«» 0xa0
|
||||
// ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐ 0xb0
|
||||
// └┴┬├─┼╞╟╚╔╩╦╠═╬╧ 0xc0
|
||||
// ╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ 0xd0
|
||||
// αßΓπΣσμτΦΘΩδ∞φε∩ 0xe0
|
||||
// ≡±≥≤⌠⌡÷≈°∙×√ⁿ²■λ 0xf0
|
||||
|
||||
const char kHostChars[256] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x00
|
||||
|
|
|
@ -18,27 +18,27 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "net/http/escape.h"
|
||||
|
||||
// generated by:
|
||||
// o//tool/build/xlat.com -TiC ' ()<>@,;:\"/[]?={}' -iskHttpToken
|
||||
// generated by:
|
||||
// o//tool/build/xlat.com -TiC ' ()<>@,;:\"/[]?={}' -iskHttpToken
|
||||
//
|
||||
// present absent
|
||||
// ──────────────── ────────────────
|
||||
// ∅☺☻♥♦♣♠•◘○◙♂♀♪♫☼ 0x00
|
||||
// ►◄↕‼¶§▬↨↑↓→←∟↔▲▼ 0x10
|
||||
// ! #$%&‘ *+ -. ␠ “ () , / 0x20
|
||||
// 0123456789 :;<=>⁇ 0x30
|
||||
// ABCDEFGHIJKLMNO @ 0x40
|
||||
// PQRSTUVWXYZ ^_ [⭝] 0x50
|
||||
// `abcdefghijklmno 0x60
|
||||
// pqrstuvwxyz | ~ { } ⌂ 0x70
|
||||
// ÇüéâäàåçêëèïîìÄÅ 0x80
|
||||
// ÉæÆôöòûùÿÖÜ¢£¥€ƒ 0x90
|
||||
// áíóúñѪº¿⌐¬½¼¡«» 0xa0
|
||||
// ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐ 0xb0
|
||||
// └┴┬├─┼╞╟╚╔╩╦╠═╬╧ 0xc0
|
||||
// ╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ 0xd0
|
||||
// αßΓπΣσμτΦΘΩδ∞φε∩ 0xe0
|
||||
// ≡±≥≤⌠⌡÷≈°∙×√ⁿ²■λ 0xf0
|
||||
// present absent
|
||||
// ──────────────── ────────────────
|
||||
// ∅☺☻♥♦♣♠•◘○◙♂♀♪♫☼ 0x00
|
||||
// ►◄↕‼¶§▬↨↑↓→←∟↔▲▼ 0x10
|
||||
// ! #$%&‘ *+ -. ␠ “ () , / 0x20
|
||||
// 0123456789 :;<=>⁇ 0x30
|
||||
// ABCDEFGHIJKLMNO @ 0x40
|
||||
// PQRSTUVWXYZ ^_ [⭝] 0x50
|
||||
// `abcdefghijklmno 0x60
|
||||
// pqrstuvwxyz | ~ { } ⌂ 0x70
|
||||
// ÇüéâäàåçêëèïîìÄÅ 0x80
|
||||
// ÉæÆôöòûùÿÖÜ¢£¥€ƒ 0x90
|
||||
// áíóúñѪº¿⌐¬½¼¡«» 0xa0
|
||||
// ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐ 0xb0
|
||||
// └┴┬├─┼╞╟╚╔╩╦╠═╬╧ 0xc0
|
||||
// ╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ 0xd0
|
||||
// αßΓπΣσμτΦΘΩδ∞φε∩ 0xe0
|
||||
// ≡±≥≤⌠⌡÷≈°∙×√ⁿ²■λ 0xf0
|
||||
|
||||
const char kHttpToken[256] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x00
|
||||
|
@ -59,14 +59,14 @@ const char kHttpToken[256] = {
|
|||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xf0
|
||||
};
|
||||
|
||||
// @see RFC2616
|
||||
// CHAR = <any US-ASCII character (octets 0 - 127)>
|
||||
// SP = <US-ASCII SP, space (32)>
|
||||
// HT = <US-ASCII HT, horizontal-tab (9)>
|
||||
// CTL = <any US-ASCII control character
|
||||
// (octets 0 - 31) and DEL (127)>
|
||||
// token = 1*<any CHAR except CTLs or separators>
|
||||
// separators = "(" | ")" | "<" | ">" | "@"
|
||||
// | "," | ";" | ":" | "\" | <">
|
||||
// | "/" | "[" | "]" | "?" | "="
|
||||
// | "{" | "}" | SP | HT
|
||||
// @see RFC2616
|
||||
// CHAR = <any US-ASCII character (octets 0 - 127)>
|
||||
// SP = <US-ASCII SP, space (32)>
|
||||
// HT = <US-ASCII HT, horizontal-tab (9)>
|
||||
// CTL = <any US-ASCII control character
|
||||
// (octets 0 - 31) and DEL (127)>
|
||||
// token = 1*<any CHAR except CTLs or separators>
|
||||
// separators = "(" | ")" | "<" | ">" | "@"
|
||||
// | "," | ";" | ":" | "\" | <">
|
||||
// | "/" | "[" | "]" | "?" | "="
|
||||
// | "{" | "}" | SP | HT
|
||||
|
|
Loading…
Reference in a new issue