mirror of
https://github.com/dlang/phobos.git
synced 2025-05-01 15:40:36 +03:00
Automatically add spaces to binary operators (>=)
command: sed -E "s/([[:alnum:]]) >= ([[:alnum:]])/\1 >= \2/g" -i **/*.d sed -E "s/([[:alnum:]])>= ([[:alnum:]])/\1 >= \2/g" -i **/*.d sed -E "s/([[:alnum:]]) >=([[:alnum:]])/\1 >= \2/g" -i **/*.d
This commit is contained in:
parent
203755d296
commit
a1bb0515fc
8 changed files with 22 additions and 22 deletions
|
@ -1567,7 +1567,7 @@ char [] biguintToHex(char [] buff, const BigDigit [] data, char separator=0,
|
||||||
LetterCase letterCase = LetterCase.upper) pure nothrow @safe
|
LetterCase letterCase = LetterCase.upper) pure nothrow @safe
|
||||||
{
|
{
|
||||||
int x=0;
|
int x=0;
|
||||||
for (ptrdiff_t i=data.length - 1; i>=0; --i)
|
for (ptrdiff_t i=data.length - 1; i >= 0; --i)
|
||||||
{
|
{
|
||||||
toHexZeroPadded(buff[x .. x+8], data[i], letterCase);
|
toHexZeroPadded(buff[x .. x+8], data[i], letterCase);
|
||||||
x+=8;
|
x+=8;
|
||||||
|
@ -1772,10 +1772,10 @@ body
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Now set y = all remaining digits.
|
// Now set y = all remaining digits.
|
||||||
if (lo>=18)
|
if (lo >= 18)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
else if (lo>=9)
|
else if (lo >= 9)
|
||||||
{
|
{
|
||||||
for (int k=9; k<lo; ++k) y*=10;
|
for (int k=9; k<lo; ++k) y*=10;
|
||||||
y+=x;
|
y+=x;
|
||||||
|
@ -1950,9 +1950,9 @@ bool less(const(BigDigit)[] x, const(BigDigit)[] y) pure nothrow
|
||||||
{
|
{
|
||||||
assert(x.length >= y.length);
|
assert(x.length >= y.length);
|
||||||
auto k = x.length-1;
|
auto k = x.length-1;
|
||||||
while (x[k]==0 && k>=y.length)
|
while (x[k]==0 && k >= y.length)
|
||||||
--k;
|
--k;
|
||||||
if (k>=y.length)
|
if (k >= y.length)
|
||||||
return false;
|
return false;
|
||||||
while (k>0 && x[k]==y[k])
|
while (k>0 && x[k]==y[k])
|
||||||
--k;
|
--k;
|
||||||
|
@ -2286,7 +2286,7 @@ void toHexZeroPadded(char[] output, uint value,
|
||||||
ptrdiff_t x = output.length - 1;
|
ptrdiff_t x = output.length - 1;
|
||||||
static immutable string upperHexDigits = "0123456789ABCDEF";
|
static immutable string upperHexDigits = "0123456789ABCDEF";
|
||||||
static immutable string lowerHexDigits = "0123456789abcdef";
|
static immutable string lowerHexDigits = "0123456789abcdef";
|
||||||
for ( ; x>=0; --x)
|
for ( ; x >= 0; --x)
|
||||||
{
|
{
|
||||||
if (letterCase == LetterCase.upper)
|
if (letterCase == LetterCase.upper)
|
||||||
{
|
{
|
||||||
|
@ -2440,7 +2440,7 @@ body
|
||||||
}
|
}
|
||||||
|
|
||||||
// rem -= quot * v[0 .. k].
|
// rem -= quot * v[0 .. k].
|
||||||
// If would make rem negative, decrease quot until rem is >=0.
|
// If would make rem negative, decrease quot until rem is >= 0.
|
||||||
// Needs (quot.length * k) scratch space to store the result of the multiply.
|
// Needs (quot.length * k) scratch space to store the result of the multiply.
|
||||||
void adjustRemainder(BigDigit[] quot, BigDigit[] rem, const(BigDigit)[] v,
|
void adjustRemainder(BigDigit[] quot, BigDigit[] rem, const(BigDigit)[] v,
|
||||||
ptrdiff_t k,
|
ptrdiff_t k,
|
||||||
|
|
|
@ -286,7 +286,7 @@ uint multibyteDivAssign(uint [] dest, uint divisor, uint overflow)
|
||||||
pure @nogc @safe
|
pure @nogc @safe
|
||||||
{
|
{
|
||||||
ulong c = cast(ulong) overflow;
|
ulong c = cast(ulong) overflow;
|
||||||
for (ptrdiff_t i = dest.length-1; i>= 0; --i)
|
for (ptrdiff_t i = dest.length-1; i >= 0; --i)
|
||||||
{
|
{
|
||||||
c = (c << 32) + cast(ulong)(dest[i]);
|
c = (c << 32) + cast(ulong)(dest[i]);
|
||||||
uint q = cast(uint)(c/divisor);
|
uint q = cast(uint)(c/divisor);
|
||||||
|
|
|
@ -365,7 +365,7 @@ assert(isIdentical(normalDistributionImpl(NaN(0x325)), NaN(0x325)));
|
||||||
*/
|
*/
|
||||||
real normalDistributionInvImpl(real p)
|
real normalDistributionInvImpl(real p)
|
||||||
in {
|
in {
|
||||||
assert(p>=0.0L && p <= 1.0L, "Domain error");
|
assert(p >= 0.0L && p <= 1.0L, "Domain error");
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
@ -419,7 +419,7 @@ static immutable real[8] Q3 =
|
||||||
0x1.e05268dd3c07989ep-3, 0x1.239c6aff14afbf82p+1, 1.0
|
0x1.e05268dd3c07989ep-3, 0x1.239c6aff14afbf82p+1, 1.0
|
||||||
];
|
];
|
||||||
|
|
||||||
if (p <= 0.0L || p>=1.0L)
|
if (p <= 0.0L || p >= 1.0L)
|
||||||
{
|
{
|
||||||
if (p == 0.0L)
|
if (p == 0.0L)
|
||||||
return -real.infinity;
|
return -real.infinity;
|
||||||
|
|
|
@ -1427,7 +1427,7 @@ body {
|
||||||
*/
|
*/
|
||||||
real gammaIncompleteComplInv(real a, real p)
|
real gammaIncompleteComplInv(real a, real p)
|
||||||
in {
|
in {
|
||||||
assert(p>=0 && p <= 1);
|
assert(p >= 0 && p <= 1);
|
||||||
assert(a>0);
|
assert(a>0);
|
||||||
}
|
}
|
||||||
body {
|
body {
|
||||||
|
@ -1688,7 +1688,7 @@ done:
|
||||||
for (int k=1; k<40; ++k)
|
for (int k=1; k<40; ++k)
|
||||||
{
|
{
|
||||||
real y=0;
|
real y=0;
|
||||||
for (int u=k; u>=1; --u)
|
for (int u=k; u >= 1; --u)
|
||||||
{
|
{
|
||||||
y += 1.0L/u;
|
y += 1.0L/u;
|
||||||
}
|
}
|
||||||
|
|
|
@ -514,7 +514,7 @@ if (is(typeof(Num.init >= 0)) && is(typeof(-Num.init)) &&
|
||||||
static if (isFloatingPoint!(Num))
|
static if (isFloatingPoint!(Num))
|
||||||
return fabs(x);
|
return fabs(x);
|
||||||
else
|
else
|
||||||
return x>=0 ? x : -x;
|
return x >= 0 ? x : -x;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
|
@ -2827,7 +2827,7 @@ if (isIntegral!T && isSigned!T)
|
||||||
import std.traits : Unsigned;
|
import std.traits : Unsigned;
|
||||||
// Note: abs(x) can not be used because the return type is not Unsigned and
|
// Note: abs(x) can not be used because the return type is not Unsigned and
|
||||||
// the return value would be wrong for x == int.min
|
// the return value would be wrong for x == int.min
|
||||||
Unsigned!T absx = x>=0 ? x : -x;
|
Unsigned!T absx = x >= 0 ? x : -x;
|
||||||
return ilogb(absx);
|
return ilogb(absx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6647,7 +6647,7 @@ body
|
||||||
{
|
{
|
||||||
// Runtime behaviour for contract violation:
|
// Runtime behaviour for contract violation:
|
||||||
// If signs are opposite, or one is a NaN, return 0.
|
// If signs are opposite, or one is a NaN, return 0.
|
||||||
if (!((x>=0 && y>=0) || (x <= 0 && y <= 0))) return 0.0;
|
if (!((x >= 0 && y >= 0) || (x <= 0 && y <= 0))) return 0.0;
|
||||||
|
|
||||||
// The implementation is simple: cast x and y to integers,
|
// The implementation is simple: cast x and y to integers,
|
||||||
// average them (avoiding overflow), and cast the result back to a floating-point number.
|
// average them (avoiding overflow), and cast the result back to a floating-point number.
|
||||||
|
|
|
@ -351,7 +351,7 @@ real normalDistribution(real x)
|
||||||
*/
|
*/
|
||||||
real normalDistributionInverse(real p)
|
real normalDistributionInverse(real p)
|
||||||
in {
|
in {
|
||||||
assert(p>=0.0L && p <= 1.0L, "Domain error");
|
assert(p >= 0.0L && p <= 1.0L, "Domain error");
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
|
|
|
@ -588,7 +588,7 @@ public:
|
||||||
{
|
{
|
||||||
auto x = get!real;
|
auto x = get!real;
|
||||||
auto y = cast(real) b;
|
auto y = cast(real) b;
|
||||||
return (x>=y)-(x <= y);
|
return (x >= y)-(x <= y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
|
@ -2602,7 +2602,7 @@ T gcd(T)(T a, T b)
|
||||||
{
|
{
|
||||||
static if (T.min < 0)
|
static if (T.min < 0)
|
||||||
{
|
{
|
||||||
assert(a >= 0 && b >=0);
|
assert(a >= 0 && b >= 0);
|
||||||
}
|
}
|
||||||
while (b)
|
while (b)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2115,7 +2115,7 @@ string alignForSize(E...)(const char[][] names...)
|
||||||
foreach (i, T; E)
|
foreach (i, T; E)
|
||||||
{
|
{
|
||||||
auto a = T.alignof;
|
auto a = T.alignof;
|
||||||
auto k = a>=64? 0 : a>=32? 1 : a>=16? 2 : a>=8? 3 : a>=4? 4 : a>=2? 5 : 6;
|
auto k = a >= 64? 0 : a >= 32? 1 : a >= 16? 2 : a >= 8? 3 : a >= 4? 4 : a >= 2? 5 : 6;
|
||||||
declaration[k] ~= T.stringof ~ " " ~ names[i] ~ ";\n";
|
declaration[k] ~= T.stringof ~ " " ~ names[i] ~ ";\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6183,7 +6183,7 @@ mixin template Proxy(alias a)
|
||||||
assert(!(a<b));
|
assert(!(a<b));
|
||||||
assert(!(a <= b));
|
assert(!(a <= b));
|
||||||
assert(!(a>b));
|
assert(!(a>b));
|
||||||
assert(!(a>=b));
|
assert(!(a >= b));
|
||||||
}
|
}
|
||||||
foreach (T1; AliasSeq!(MyFloatImpl, Typedef!float, Typedef!double,
|
foreach (T1; AliasSeq!(MyFloatImpl, Typedef!float, Typedef!double,
|
||||||
float, real, Typedef!int, int))
|
float, real, Typedef!int, int))
|
||||||
|
@ -6203,14 +6203,14 @@ mixin template Proxy(alias a)
|
||||||
assert(a<b);
|
assert(a<b);
|
||||||
assert(a <= b);
|
assert(a <= b);
|
||||||
assert(!(a>b));
|
assert(!(a>b));
|
||||||
assert(!(a>=b));
|
assert(!(a >= b));
|
||||||
|
|
||||||
a = 4;
|
a = 4;
|
||||||
assert(a == b);
|
assert(a == b);
|
||||||
assert(!(a<b));
|
assert(!(a<b));
|
||||||
assert(a <= b);
|
assert(a <= b);
|
||||||
assert(!(a>b));
|
assert(!(a>b));
|
||||||
assert(a>=b);
|
assert(a >= b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue