mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-12-23 13:47:47 +00:00
mnemonics: fix outrageous compile time with CLANG in release
from several minutes to 10-15 seconds
This commit is contained in:
parent
91c7d68b2d
commit
f0bc684ccd
14 changed files with 89 additions and 41 deletions
|
@ -72,7 +72,10 @@ namespace Language
|
|||
class Chinese_Simplified: public Base
|
||||
{
|
||||
public:
|
||||
Chinese_Simplified(): Base("简体中文 (中国)", "Chinese (simplified)", std::vector<std::string>({
|
||||
Chinese_Simplified(): Base("简体中文 (中国)", "Chinese (simplified)", {}, 1)
|
||||
{
|
||||
static constexpr const char * const words[NWORDS] =
|
||||
{
|
||||
"的",
|
||||
"一",
|
||||
"是",
|
||||
|
@ -1699,8 +1702,8 @@ namespace Language
|
|||
"秒",
|
||||
"浙",
|
||||
"貌"
|
||||
}), 1)
|
||||
{
|
||||
};
|
||||
set_words(words);
|
||||
populate_maps();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -49,7 +49,10 @@ namespace Language
|
|||
class Dutch: public Base
|
||||
{
|
||||
public:
|
||||
Dutch(): Base("Nederlands", "Dutch", std::vector<std::string>({
|
||||
Dutch(): Base("Nederlands", "Dutch", {}, 4)
|
||||
{
|
||||
static constexpr const char * const words[NWORDS] =
|
||||
{
|
||||
"aalglad",
|
||||
"aalscholver",
|
||||
"aambeeld",
|
||||
|
@ -1676,8 +1679,8 @@ namespace Language
|
|||
"zwiep",
|
||||
"zwijmel",
|
||||
"zworen"
|
||||
}), 4)
|
||||
{
|
||||
};
|
||||
set_words(words);
|
||||
populate_maps();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -49,7 +49,10 @@ namespace Language
|
|||
class English: public Base
|
||||
{
|
||||
public:
|
||||
English(): Base("English", "English", std::vector<std::string>({
|
||||
English(): Base("English", "English", {}, 3)
|
||||
{
|
||||
static constexpr const char * const words[NWORDS] =
|
||||
{
|
||||
"abbey",
|
||||
"abducts",
|
||||
"ability",
|
||||
|
@ -1676,8 +1679,8 @@ namespace Language
|
|||
"zombie",
|
||||
"zones",
|
||||
"zoom"
|
||||
}), 3)
|
||||
{
|
||||
};
|
||||
set_words(words);
|
||||
populate_maps();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -51,7 +51,10 @@ namespace Language
|
|||
class EnglishOld: public Base
|
||||
{
|
||||
public:
|
||||
EnglishOld(): Base("EnglishOld", "English (old)", std::vector<std::string>({
|
||||
EnglishOld(): Base("EnglishOld", "English (old)", {}, 4)
|
||||
{
|
||||
static constexpr const char * const words[NWORDS] =
|
||||
{
|
||||
"like",
|
||||
"just",
|
||||
"love",
|
||||
|
@ -1678,8 +1681,8 @@ namespace Language
|
|||
"unseen",
|
||||
"weapon",
|
||||
"weary"
|
||||
}), 4)
|
||||
{
|
||||
};
|
||||
set_words(words);
|
||||
populate_maps(ALLOW_DUPLICATE_PREFIXES | ALLOW_SHORT_WORDS);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -58,7 +58,10 @@ namespace Language
|
|||
class Esperanto: public Base
|
||||
{
|
||||
public:
|
||||
Esperanto(): Base("Esperanto", "Esperanto", std::vector<std::string>({
|
||||
Esperanto(): Base("Esperanto", "Esperanto", {}, 4)
|
||||
{
|
||||
static constexpr const char * const words[NWORDS] =
|
||||
{
|
||||
"abako",
|
||||
"abdiki",
|
||||
"abelo",
|
||||
|
@ -1685,8 +1688,8 @@ namespace Language
|
|||
"zorgi",
|
||||
"zukino",
|
||||
"zumilo",
|
||||
}), 4)
|
||||
{
|
||||
};
|
||||
set_words(words);
|
||||
populate_maps();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -49,7 +49,10 @@ namespace Language
|
|||
class French: public Base
|
||||
{
|
||||
public:
|
||||
French(): Base("Français", "French", std::vector<std::string>({
|
||||
French(): Base("Français", "French", {}, 4)
|
||||
{
|
||||
static constexpr const char * const words[NWORDS] =
|
||||
{
|
||||
"abandon",
|
||||
"abattre",
|
||||
"aboi",
|
||||
|
@ -1676,8 +1679,8 @@ namespace Language
|
|||
"zinc",
|
||||
"zone",
|
||||
"zoom"
|
||||
}), 4)
|
||||
{
|
||||
};
|
||||
set_words(words);
|
||||
populate_maps();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -51,7 +51,10 @@ namespace Language
|
|||
class German: public Base
|
||||
{
|
||||
public:
|
||||
German(): Base("Deutsch", "German", std::vector<std::string>({
|
||||
German(): Base("Deutsch", "German", {}, 4)
|
||||
{
|
||||
static constexpr const char * const words[NWORDS] =
|
||||
{
|
||||
"Abakus",
|
||||
"Abart",
|
||||
"abbilden",
|
||||
|
@ -1678,8 +1681,8 @@ namespace Language
|
|||
"Zündung",
|
||||
"Zweck",
|
||||
"Zyklop"
|
||||
}), 4)
|
||||
{
|
||||
};
|
||||
set_words(words);
|
||||
populate_maps();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -51,7 +51,10 @@ namespace Language
|
|||
class Italian: public Base
|
||||
{
|
||||
public:
|
||||
Italian(): Base("Italiano", "Italian", std::vector<std::string>({
|
||||
Italian(): Base("Italiano", "Italian", {}, 4)
|
||||
{
|
||||
static constexpr const char * const words[NWORDS] =
|
||||
{
|
||||
"abbinare",
|
||||
"abbonato",
|
||||
"abisso",
|
||||
|
@ -1678,8 +1681,8 @@ namespace Language
|
|||
"zolfo",
|
||||
"zombie",
|
||||
"zucchero"
|
||||
}), 4)
|
||||
{
|
||||
};
|
||||
set_words(words);
|
||||
populate_maps();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -71,7 +71,10 @@ namespace Language
|
|||
class Japanese: public Base
|
||||
{
|
||||
public:
|
||||
Japanese(): Base("日本語", "Japanese", std::vector<std::string>({
|
||||
Japanese(): Base("日本語", "Japanese", {}, 3)
|
||||
{
|
||||
static constexpr const char * const words[NWORDS] =
|
||||
{
|
||||
"あいこくしん",
|
||||
"あいさつ",
|
||||
"あいだ",
|
||||
|
@ -1698,8 +1701,8 @@ namespace Language
|
|||
"ひさん",
|
||||
"びじゅつかん",
|
||||
"ひしょ"
|
||||
}), 3)
|
||||
{
|
||||
};
|
||||
set_words(words);
|
||||
populate_maps();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -83,7 +83,10 @@ namespace Language
|
|||
ALLOW_SHORT_WORDS = 1<<0,
|
||||
ALLOW_DUPLICATE_PREFIXES = 1<<1,
|
||||
};
|
||||
const std::vector<std::string> word_list; /*!< A pointer to the array of words */
|
||||
enum {
|
||||
NWORDS = 1626
|
||||
};
|
||||
std::vector<std::string> word_list; /*!< A pointer to the array of words */
|
||||
std::unordered_map<epee::wipeable_string, uint32_t> word_map; /*!< hash table to find word's index */
|
||||
std::unordered_map<epee::wipeable_string, uint32_t> trimmed_word_map; /*!< hash table to find word's trimmed index */
|
||||
std::string language_name; /*!< Name of language */
|
||||
|
@ -96,7 +99,7 @@ namespace Language
|
|||
{
|
||||
int ii;
|
||||
std::vector<std::string>::const_iterator it;
|
||||
if (word_list.size () != 1626)
|
||||
if (word_list.size () != NWORDS)
|
||||
throw std::runtime_error("Wrong word list length for " + language_name);
|
||||
for (it = word_list.begin(), ii = 0; it != word_list.end(); it++, ii++)
|
||||
{
|
||||
|
@ -138,6 +141,12 @@ namespace Language
|
|||
virtual ~Base()
|
||||
{
|
||||
}
|
||||
void set_words(const char * const words[])
|
||||
{
|
||||
word_list.resize(NWORDS);
|
||||
for (size_t i = 0; i < NWORDS; ++i)
|
||||
word_list[i] = words[i];
|
||||
}
|
||||
/*!
|
||||
* \brief Returns a pointer to the word list.
|
||||
* \return A pointer to the word list.
|
||||
|
|
|
@ -56,7 +56,10 @@ namespace Language
|
|||
class Lojban: public Base
|
||||
{
|
||||
public:
|
||||
Lojban(): Base("Lojban", "Lojban", std::vector<std::string>({
|
||||
Lojban(): Base("Lojban", "Lojban", {}, 4)
|
||||
{
|
||||
static constexpr const char * const words[NWORDS] =
|
||||
{
|
||||
"backi",
|
||||
"bacru",
|
||||
"badna",
|
||||
|
@ -1683,8 +1686,8 @@ namespace Language
|
|||
"noltruti'u",
|
||||
"samtci",
|
||||
"snaxa'a",
|
||||
}), 4)
|
||||
{
|
||||
};
|
||||
set_words(words);
|
||||
populate_maps();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -72,7 +72,10 @@ namespace Language
|
|||
class Portuguese: public Base
|
||||
{
|
||||
public:
|
||||
Portuguese(): Base("Português", "Portuguese", std::vector<std::string>({
|
||||
Portuguese(): Base("Português", "Portuguese", {}, 4)
|
||||
{
|
||||
static constexpr const char * const words[NWORDS] =
|
||||
{
|
||||
"abaular",
|
||||
"abdominal",
|
||||
"abeto",
|
||||
|
@ -1699,8 +1702,8 @@ namespace Language
|
|||
"zeloso",
|
||||
"zenite",
|
||||
"zumbi"
|
||||
}), 4)
|
||||
{
|
||||
};
|
||||
set_words(words);
|
||||
populate_maps();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -51,7 +51,10 @@ namespace Language
|
|||
class Russian: public Base
|
||||
{
|
||||
public:
|
||||
Russian(): Base("русский язык", "Russian", std::vector<std::string>({
|
||||
Russian(): Base("русский язык", "Russian", {}, 4)
|
||||
{
|
||||
static constexpr const char * const words[NWORDS] =
|
||||
{
|
||||
"абажур",
|
||||
"абзац",
|
||||
"абонент",
|
||||
|
@ -1678,8 +1681,8 @@ namespace Language
|
|||
"яхта",
|
||||
"ячейка",
|
||||
"ящик"
|
||||
}), 4)
|
||||
{
|
||||
};
|
||||
set_words(words);
|
||||
populate_maps();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -72,7 +72,10 @@ namespace Language
|
|||
class Spanish: public Base
|
||||
{
|
||||
public:
|
||||
Spanish(): Base("Español", "Spanish", std::vector<std::string>({
|
||||
Spanish(): Base("Español", "Spanish", {}, 4)
|
||||
{
|
||||
static constexpr const char * const words[NWORDS] =
|
||||
{
|
||||
"ábaco",
|
||||
"abdomen",
|
||||
"abeja",
|
||||
|
@ -1699,8 +1702,8 @@ namespace Language
|
|||
"risa",
|
||||
"ritmo",
|
||||
"rito"
|
||||
}), 4)
|
||||
{
|
||||
};
|
||||
set_words(words);
|
||||
populate_maps(ALLOW_SHORT_WORDS);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue