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
ef7be4b60d
commit
203755d296
6 changed files with 21 additions and 21 deletions
|
@ -2327,7 +2327,7 @@ private template TimSortImpl(alias pred, R)
|
||||||
size_t minRunLength()(size_t n)
|
size_t minRunLength()(size_t n)
|
||||||
{
|
{
|
||||||
immutable shift = bsr(n)-5;
|
immutable shift = bsr(n)-5;
|
||||||
auto result = (n>>shift) + !!(n & ~((1 << shift)-1));
|
auto result = (n >> shift) + !!(n & ~((1 << shift)-1));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -461,7 +461,7 @@ public:
|
||||||
{
|
{
|
||||||
assert(y>0);
|
assert(y>0);
|
||||||
uint bits = cast(uint) y & BIGDIGITSHIFTMASK;
|
uint bits = cast(uint) y & BIGDIGITSHIFTMASK;
|
||||||
if ((y>>LG2BIGDIGITBITS) >= data.length) return BigUint(ZERO);
|
if ((y >> LG2BIGDIGITBITS) >= data.length) return BigUint(ZERO);
|
||||||
uint words = cast(uint)(y >> LG2BIGDIGITBITS);
|
uint words = cast(uint)(y >> LG2BIGDIGITBITS);
|
||||||
if (bits == 0)
|
if (bits == 0)
|
||||||
{
|
{
|
||||||
|
@ -485,7 +485,7 @@ public:
|
||||||
assert(y>0);
|
assert(y>0);
|
||||||
if (isZero()) return this;
|
if (isZero()) return this;
|
||||||
uint bits = cast(uint) y & BIGDIGITSHIFTMASK;
|
uint bits = cast(uint) y & BIGDIGITSHIFTMASK;
|
||||||
assert((y>>LG2BIGDIGITBITS) < cast(ulong)(uint.max));
|
assert((y >> LG2BIGDIGITBITS) < cast(ulong)(uint.max));
|
||||||
uint words = cast(uint)(y >> LG2BIGDIGITBITS);
|
uint words = cast(uint)(y >> LG2BIGDIGITBITS);
|
||||||
BigDigit [] result = new BigDigit[data.length + words+1];
|
BigDigit [] result = new BigDigit[data.length + words+1];
|
||||||
result[0 .. words] = 0;
|
result[0 .. words] = 0;
|
||||||
|
@ -538,7 +538,7 @@ public:
|
||||||
}
|
}
|
||||||
if (d > uint.max)
|
if (d > uint.max)
|
||||||
{
|
{
|
||||||
r.data = [cast(uint)(d & 0xFFFF_FFFF), cast(uint)(d>>32)];
|
r.data = [cast(uint)(d & 0xFFFF_FFFF), cast(uint)(d >> 32)];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1761,7 +1761,7 @@ body
|
||||||
else
|
else
|
||||||
hi = 2;
|
hi = 2;
|
||||||
uint c = multibyteIncrementAssign!('+')(data[0 .. hi], cast(uint)(y&0xFFFF_FFFF));
|
uint c = multibyteIncrementAssign!('+')(data[0 .. hi], cast(uint)(y&0xFFFF_FFFF));
|
||||||
c += multibyteIncrementAssign!('+')(data[1 .. hi], cast(uint)(y>>32));
|
c += multibyteIncrementAssign!('+')(data[1 .. hi], cast(uint)(y >> 32));
|
||||||
if (c != 0)
|
if (c != 0)
|
||||||
{
|
{
|
||||||
data[hi]=c;
|
data[hi]=c;
|
||||||
|
@ -1815,7 +1815,7 @@ body
|
||||||
uint c = multibyteIncrementAssign!('+')(data[0 .. hi], cast(uint)(y&0xFFFF_FFFF));
|
uint c = multibyteIncrementAssign!('+')(data[0 .. hi], cast(uint)(y&0xFFFF_FFFF));
|
||||||
if (y > 0xFFFF_FFFFL)
|
if (y > 0xFFFF_FFFFL)
|
||||||
{
|
{
|
||||||
c += multibyteIncrementAssign!('+')(data[1 .. hi], cast(uint)(y>>32));
|
c += multibyteIncrementAssign!('+')(data[1 .. hi], cast(uint)(y >> 32));
|
||||||
}
|
}
|
||||||
if (c != 0)
|
if (c != 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -235,7 +235,7 @@ uint multibyteMulAdd(char op)(uint [] dest, const(uint)[] src,
|
||||||
c += cast(ulong) multiplier * src[i];
|
c += cast(ulong) multiplier * src[i];
|
||||||
ulong t = cast(ulong) dest[i] - cast(uint) c;
|
ulong t = cast(ulong) dest[i] - cast(uint) c;
|
||||||
dest[i] = cast(uint) t;
|
dest[i] = cast(uint) t;
|
||||||
c = cast(uint)((c>>32) - (t>>32));
|
c = cast(uint)((c >> 32) - (t >> 32));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cast(uint) c;
|
return cast(uint) c;
|
||||||
|
|
|
@ -244,7 +244,7 @@ class MmFile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int hi = cast(int)(size>>32);
|
int hi = cast(int)(size >> 32);
|
||||||
hFileMap = CreateFileMappingW(hFile, null, flProtect,
|
hFileMap = CreateFileMappingW(hFile, null, flProtect,
|
||||||
hi, cast(uint) size, null);
|
hi, cast(uint) size, null);
|
||||||
wenforce(hFileMap, "CreateFileMapping");
|
wenforce(hFileMap, "CreateFileMapping");
|
||||||
|
@ -523,7 +523,7 @@ class MmFile
|
||||||
len = cast(size_t)(size-start);
|
len = cast(size_t)(size-start);
|
||||||
version(Windows)
|
version(Windows)
|
||||||
{
|
{
|
||||||
uint hi = cast(uint)(start>>32);
|
uint hi = cast(uint)(start >> 32);
|
||||||
p = MapViewOfFileEx(hFileMap, dwDesiredAccess, hi, cast(uint) start, len, address);
|
p = MapViewOfFileEx(hFileMap, dwDesiredAccess, hi, cast(uint) start, len, address);
|
||||||
wenforce(p, "MapViewOfFileEx");
|
wenforce(p, "MapViewOfFileEx");
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,7 +277,7 @@ struct Bytecode
|
||||||
|
|
||||||
//ditto
|
//ditto
|
||||||
//0-arg template due to @@@BUG@@@ 10985
|
//0-arg template due to @@@BUG@@@ 10985
|
||||||
@property IR code()() const { return cast(IR)(raw>>24); }
|
@property IR code()() const { return cast(IR)(raw >> 24); }
|
||||||
|
|
||||||
//ditto
|
//ditto
|
||||||
@property bool hotspot() const { return hasMerge(code); }
|
@property bool hotspot() const { return hasMerge(code); }
|
||||||
|
|
22
std/uni.d
22
std/uni.d
|
@ -3045,13 +3045,13 @@ private:
|
||||||
version(LittleEndian)
|
version(LittleEndian)
|
||||||
{
|
{
|
||||||
ptr[idx] = val & 0xFF;
|
ptr[idx] = val & 0xFF;
|
||||||
ptr[idx+1] = (val>>8) & 0xFF;
|
ptr[idx+1] = (val >> 8) & 0xFF;
|
||||||
ptr[idx+2] = (val>>16) & 0xFF;
|
ptr[idx+2] = (val >> 16) & 0xFF;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ptr[idx] = (val>>16) & 0xFF;
|
ptr[idx] = (val >> 16) & 0xFF;
|
||||||
ptr[idx+1] = (val>>8) & 0xFF;
|
ptr[idx+1] = (val >> 8) & 0xFF;
|
||||||
ptr[idx+2] = val & 0xFF;
|
ptr[idx+2] = val & 0xFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4931,7 +4931,7 @@ template Utf16Matcher()
|
||||||
assert(ch <= 0xF_FFFF);
|
assert(ch <= 0xF_FFFF);
|
||||||
wchar[2] ret;
|
wchar[2] ret;
|
||||||
//do not put surrogate bits, they are sliced off
|
//do not put surrogate bits, they are sliced off
|
||||||
ret[0] = cast(wchar)(ch>>10);
|
ret[0] = cast(wchar)(ch >> 10);
|
||||||
ret[1] = (ch & 0xFFF);
|
ret[1] = (ch & 0xFFF);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -5701,13 +5701,13 @@ if (is(Char1 : dchar) && is(Char2 : dchar))
|
||||||
arr ~= cast(ubyte) val;
|
arr ~= cast(ubyte) val;
|
||||||
else if (val < (1 << 13))
|
else if (val < (1 << 13))
|
||||||
{
|
{
|
||||||
arr ~= (0b1_00 << 5) | cast(ubyte)(val>>8);
|
arr ~= (0b1_00 << 5) | cast(ubyte)(val >> 8);
|
||||||
arr ~= val & 0xFF;
|
arr ~= val & 0xFF;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(val < (1 << 21));
|
assert(val < (1 << 21));
|
||||||
arr ~= (0b1_01 << 5) | cast(ubyte)(val>>16);
|
arr ~= (0b1_01 << 5) | cast(ubyte)(val >> 16);
|
||||||
arr ~= (val >> 8) & 0xFF;
|
arr ~= (val >> 8) & 0xFF;
|
||||||
arr ~= val & 0xFF;
|
arr ~= val & 0xFF;
|
||||||
}
|
}
|
||||||
|
@ -5719,7 +5719,7 @@ if (is(Char1 : dchar) && is(Char2 : dchar))
|
||||||
immutable first = arr[idx++];
|
immutable first = arr[idx++];
|
||||||
if (!(first & 0x80)) // no top bit -> [0 .. 127]
|
if (!(first & 0x80)) // no top bit -> [0 .. 127]
|
||||||
return first;
|
return first;
|
||||||
immutable extra = ((first>>5) & 1) + 1; // [1, 2]
|
immutable extra = ((first >> 5) & 1) + 1; // [1, 2]
|
||||||
uint val = (first & 0x1F);
|
uint val = (first & 0x1F);
|
||||||
enforce(idx + extra <= arr.length, "bad code point interval encoding");
|
enforce(idx + extra <= arr.length, "bad code point interval encoding");
|
||||||
foreach (j; 0 .. extra)
|
foreach (j; 0 .. extra)
|
||||||
|
@ -8134,7 +8134,7 @@ if (isSomeString!S)
|
||||||
{
|
{
|
||||||
auto val = tableFn(idx);
|
auto val = tableFn(idx);
|
||||||
// unpack length + codepoint
|
// unpack length + codepoint
|
||||||
immutable uint len = val>>24;
|
immutable uint len = val >> 24;
|
||||||
result.put(cast(dchar)(val & 0xFF_FFFF));
|
result.put(cast(dchar)(val & 0xFF_FFFF));
|
||||||
foreach (j; idx+1 .. idx+len)
|
foreach (j; idx+1 .. idx+len)
|
||||||
result.put(tableFn(j));
|
result.put(tableFn(j));
|
||||||
|
@ -8736,7 +8736,7 @@ private template toCaseLength(alias indexFn, uint maxIdx, alias tableFn)
|
||||||
codeLen += startIdx - lastNonTrivial;
|
codeLen += startIdx - lastNonTrivial;
|
||||||
lastNonTrivial = curIdx;
|
lastNonTrivial = curIdx;
|
||||||
immutable val = tableFn(caseIndex);
|
immutable val = tableFn(caseIndex);
|
||||||
immutable len = val>>24;
|
immutable len = val >> 24;
|
||||||
immutable dchar cased = val & 0xFF_FFFF;
|
immutable dchar cased = val & 0xFF_FFFF;
|
||||||
codeLen += codeLength!C(cased);
|
codeLen += codeLength!C(cased);
|
||||||
foreach (j; caseIndex+1 .. caseIndex+len)
|
foreach (j; caseIndex+1 .. caseIndex+len)
|
||||||
|
@ -8796,7 +8796,7 @@ private template toCaseInPlaceAlloc(alias indexFn, uint maxIdx, alias tableFn)
|
||||||
destIdx += toCopy;
|
destIdx += toCopy;
|
||||||
auto val = tableFn(caseIndex);
|
auto val = tableFn(caseIndex);
|
||||||
// unpack length + codepoint
|
// unpack length + codepoint
|
||||||
immutable uint len = val>>24;
|
immutable uint len = val >> 24;
|
||||||
destIdx = encodeTo(ns, destIdx, cast(dchar)(val & 0xFF_FFFF));
|
destIdx = encodeTo(ns, destIdx, cast(dchar)(val & 0xFF_FFFF));
|
||||||
foreach (j; caseIndex+1 .. caseIndex+len)
|
foreach (j; caseIndex+1 .. caseIndex+len)
|
||||||
destIdx = encodeTo(ns, destIdx, tableFn(j));
|
destIdx = encodeTo(ns, destIdx, tableFn(j));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue