Inline two macros in the unicode tables

They were only used by one function each, in unicodetables.cpp, so
don't need to be macros.

Change-Id: I3e7f9f661568862d0a0d265bb8f657a8e0782b13
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Edward Welbourne 2020-07-31 15:47:07 +02:00
parent e6ac26ea60
commit ca034e4e50
2 changed files with 20 additions and 24 deletions
src/corelib/text
util/unicode

View File

@ -6695,14 +6695,6 @@ static const unsigned short uc_property_trie[] = {
2891, 2891, 2891, 2891, 2891, 2891, 2885, 2885
};
#define GET_PROP_INDEX(ucs4) \
(ucs4 < 0x11000 \
? (uc_property_trie[uc_property_trie[ucs4>>5] + (ucs4 & 0x1f)]) \
: (uc_property_trie[uc_property_trie[((ucs4 - 0x11000)>>8) + 0x880] + (ucs4 & 0xff)]))
#define GET_PROP_INDEX_UCS2(ucs2) \
(uc_property_trie[uc_property_trie[ucs2>>5] + (ucs2 & 0x1f)])
static const Properties uc_properties[] = {
{ 9, 18, 0, 0, -1, 0, 1, 0, { {0, 0}, {0, 0}, {0, 0}, {0, 0} }, 3, 0, 21, 0, 2 },
{ 9, 8, 0, 0, -1, 0, 1, 0, { {0, 0}, {0, 0}, {0, 0}, {0, 0} }, 3, 0, 17, 5, 2 },
@ -9600,12 +9592,16 @@ static const Properties uc_properties[] = {
Q_DECL_CONST_FUNCTION static inline const Properties *qGetProp(char32_t ucs4) noexcept
{
return uc_properties + GET_PROP_INDEX(ucs4);
if (ucs4 < 0x11000)
return uc_properties + uc_property_trie[uc_property_trie[ucs4 >> 5] + (ucs4 & 0x1f)];
return uc_properties
+ uc_property_trie[uc_property_trie[((ucs4 - 0x11000) >> 8) + 0x880] + (ucs4 & 0xff)];
}
Q_DECL_CONST_FUNCTION static inline const Properties *qGetProp(char16_t ucs2) noexcept
{
return uc_properties + GET_PROP_INDEX_UCS2(ucs2);
return uc_properties + uc_property_trie[uc_property_trie[ucs2 >> 5] + (ucs2 & 0x1f)];
}
Q_DECL_CONST_FUNCTION Q_CORE_EXPORT const Properties * QT_FASTCALL properties(char32_t ucs4) noexcept

View File

@ -2439,17 +2439,6 @@ static QByteArray createPropertyInfo()
out.chop(2);
out += "\n};\n\n";
out += "#define GET_PROP_INDEX(ucs4) \\\n"
" (ucs4 < 0x" + QByteArray::number(BMP_END, 16) + " \\\n"
" ? (uc_property_trie[uc_property_trie[ucs4>>" + QByteArray::number(BMP_SHIFT) +
"] + (ucs4 & 0x" + QByteArray::number(BMP_BLOCKSIZE-1, 16)+ ")]) \\\n"
" : (uc_property_trie[uc_property_trie[((ucs4 - 0x" + QByteArray::number(BMP_END, 16) +
")>>" + QByteArray::number(SMP_SHIFT) + ") + 0x" + QByteArray::number(BMP_END/BMP_BLOCKSIZE, 16) + "]"
" + (ucs4 & 0x" + QByteArray::number(SMP_BLOCKSIZE-1, 16) + ")]))\n\n"
"#define GET_PROP_INDEX_UCS2(ucs2) \\\n"
" (uc_property_trie[uc_property_trie[ucs2>>" + QByteArray::number(BMP_SHIFT) +
"] + (ucs2 & 0x" + QByteArray::number(BMP_BLOCKSIZE-1, 16)+ ")])\n\n";
out += "static const Properties uc_properties[] = {";
// keep in sync with the property declaration
for (int i = 0; i < uniqueProperties.size(); ++i) {
@ -2520,15 +2509,26 @@ static QByteArray createPropertyInfo()
out.chop(1);
out += "\n};\n\n";
out += "Q_DECL_CONST_FUNCTION static inline const Properties *qGetProp(char32_t ucs4) noexcept\n"
"{\n"
" return uc_properties + GET_PROP_INDEX(ucs4);\n"
" if (ucs4 < 0x" + QByteArray::number(BMP_END, 16) + ")\n"
" return uc_properties + uc_property_trie[uc_property_trie[ucs4 >> "
+ QByteArray::number(BMP_SHIFT) + "] + (ucs4 & 0x"
+ QByteArray::number(BMP_BLOCKSIZE - 1, 16)+ ")];\n"
"\n"
" return uc_properties\n"
" + uc_property_trie[uc_property_trie[((ucs4 - 0x"
+ QByteArray::number(BMP_END, 16) + ") >> "
+ QByteArray::number(SMP_SHIFT) + ") + 0x"
+ QByteArray::number(BMP_END / BMP_BLOCKSIZE, 16) + "] + (ucs4 & 0x"
+ QByteArray::number(SMP_BLOCKSIZE - 1, 16) + ")];\n"
"}\n"
"\n"
"Q_DECL_CONST_FUNCTION static inline const Properties *qGetProp(char16_t ucs2) noexcept\n"
"{\n"
" return uc_properties + GET_PROP_INDEX_UCS2(ucs2);\n"
" return uc_properties + uc_property_trie[uc_property_trie[ucs2 >> "
+ QByteArray::number(BMP_SHIFT) + "] + (ucs2 & 0x"
+ QByteArray::number(BMP_BLOCKSIZE - 1, 16) + ")];\n"
"}\n"
"\n"
"Q_DECL_CONST_FUNCTION Q_CORE_EXPORT const Properties * QT_FASTCALL properties(char32_t ucs4) noexcept\n"