mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-27 05:44:15 +08:00
libphobos: Merge upstream phobos c6e1f98fa
Phobos changes: - std.uni has been upgraded from Unicode 15.0.0 to 15.1.0. libphobos/ChangeLog: * src/MERGE: Merge upstream phobos c6e1f98fa.
This commit is contained in:
parent
4b7d4d8a4a
commit
1149588836
@ -1,4 +1,4 @@
|
||||
e4d0dd5136be3c539a02cc2f1618cb989a685837
|
||||
c6e1f98fab2cac046ed631b5c26c850a323aea53
|
||||
|
||||
The first line of this file holds the git revision number of the last
|
||||
merge done from the dlang/phobos repository.
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -8016,19 +8016,19 @@ if (isInputRange!S1 && isSomeChar!(ElementEncodingType!S1)
|
||||
if (idx2 != EMPTY_CASE_TRIE)
|
||||
{// both cased chars
|
||||
// adjust idx --> start of bucket
|
||||
idx = idx - sTable[idx].n;
|
||||
idx2 = idx2 - sTable[idx2].n;
|
||||
idx = idx - sTable(idx).n;
|
||||
idx2 = idx2 - sTable(idx2).n;
|
||||
if (idx == idx2)// one bucket, equivalent chars
|
||||
continue;
|
||||
else// not the same bucket
|
||||
diff = sTable[idx].ch - sTable[idx2].ch;
|
||||
diff = sTable(idx).ch - sTable(idx2).ch;
|
||||
}
|
||||
else
|
||||
diff = sTable[idx - sTable[idx].n].ch - rhs;
|
||||
diff = sTable(idx - sTable(idx).n).ch - rhs;
|
||||
}
|
||||
else if (idx2 != EMPTY_CASE_TRIE)
|
||||
{
|
||||
diff = lhs - sTable[idx2 - sTable[idx2].n].ch;
|
||||
diff = lhs - sTable(idx2 - sTable(idx2).n).ch;
|
||||
}
|
||||
// one of chars is not cased at all
|
||||
return diff;
|
||||
@ -8073,22 +8073,23 @@ private int fullCasedCmp(Range)(dchar lhs, dchar rhs, ref Range rtail)
|
||||
// fullCaseTrie is packed index table
|
||||
if (idx == EMPTY_CASE_TRIE)
|
||||
return lhs;
|
||||
immutable start = idx - fTable[idx].n;
|
||||
immutable end = fTable[idx].size + start;
|
||||
assert(fTable[start].entry_len == 1);
|
||||
immutable start = idx - fTable(idx).n;
|
||||
immutable end = fTable(idx).size + start;
|
||||
assert(fTable(start).entry_len == 1);
|
||||
for (idx=start; idx<end; idx++)
|
||||
{
|
||||
auto entryLen = fTable[idx].entry_len;
|
||||
const entryLen = fTable(idx).entry_len;
|
||||
if (entryLen == 1)
|
||||
{
|
||||
if (fTable[idx].seq[0] == rhs)
|
||||
if (fTable(idx).seq[0] == rhs)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{// OK it's a long chunk, like 'ss' for German
|
||||
dstring seq = fTable[idx].seq[0 .. entryLen];
|
||||
dchar[3] arr = fTable(idx).seq;
|
||||
const dchar[] seq = arr[0 .. entryLen];
|
||||
if (rhs == seq[0]
|
||||
&& rtail.skipOver(seq[1..$]))
|
||||
{
|
||||
@ -8098,7 +8099,7 @@ private int fullCasedCmp(Range)(dchar lhs, dchar rhs, ref Range rtail)
|
||||
}
|
||||
}
|
||||
}
|
||||
return fTable[start].seq[0]; // new remapped character for accurate diffs
|
||||
return fTable(start).seq[0]; // new remapped character for accurate diffs
|
||||
}
|
||||
|
||||
/++
|
||||
@ -8330,7 +8331,7 @@ package(std) auto simpleCaseFoldings(dchar ch) @safe
|
||||
{
|
||||
return c;
|
||||
}
|
||||
auto ch = sTable[idx].ch;
|
||||
auto ch = sTable(idx).ch;
|
||||
return ch;
|
||||
}
|
||||
|
||||
@ -8366,7 +8367,7 @@ package(std) auto simpleCaseFoldings(dchar ch) @safe
|
||||
immutable idx = simpleCaseTrie[ch];
|
||||
if (idx == EMPTY_CASE_TRIE)
|
||||
return Range(ch);
|
||||
auto entry = sTable[idx];
|
||||
auto entry = sTable(idx);
|
||||
immutable start = idx - entry.n;
|
||||
return Range(start, entry.size);
|
||||
}
|
||||
@ -8457,21 +8458,21 @@ public dchar compose(dchar first, dchar second) pure nothrow @safe
|
||||
{
|
||||
import std.algorithm.iteration : map;
|
||||
import std.internal.unicode_comp : compositionTable, composeCntShift, composeIdxMask;
|
||||
import std.range : assumeSorted;
|
||||
import std.range : assumeSorted, stride;
|
||||
immutable packed = compositionJumpTrie[first];
|
||||
if (packed == ushort.max)
|
||||
return dchar.init;
|
||||
// unpack offset and length
|
||||
immutable idx = packed & composeIdxMask, cnt = packed >> composeCntShift;
|
||||
// TODO: optimize this micro binary search (no more then 4-5 steps)
|
||||
auto r = compositionTable[idx .. idx+cnt].map!"a.rhs"().assumeSorted();
|
||||
auto r = compositionTable.stride(2)[idx .. idx+cnt].assumeSorted();
|
||||
immutable target = r.lowerBound(second).length;
|
||||
if (target == cnt)
|
||||
return dchar.init;
|
||||
immutable entry = compositionTable[idx+target];
|
||||
if (entry.rhs != second)
|
||||
immutable entry = compositionTable[(idx+target)*2];
|
||||
if (entry != second)
|
||||
return dchar.init;
|
||||
return entry.composed;
|
||||
return compositionTable[(idx+target)*2 + 1];
|
||||
}
|
||||
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user