diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-08-29 09:42:23 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-08-29 09:53:48 +0000 |
commit | f0bc684ccdc7bc66010254c9136f960467e6a3db (patch) | |
tree | ee691faace790a96048aaaad7b51eff65f4d5ac7 /src/mnemonics/language_base.h | |
parent | Merge pull request #4223 (diff) | |
download | monero-f0bc684ccdc7bc66010254c9136f960467e6a3db.tar.xz |
mnemonics: fix outrageous compile time with CLANG in release
from several minutes to 10-15 seconds
Diffstat (limited to '')
-rw-r--r-- | src/mnemonics/language_base.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/mnemonics/language_base.h b/src/mnemonics/language_base.h index cf518ab2a..52e784cef 100644 --- a/src/mnemonics/language_base.h +++ b/src/mnemonics/language_base.h @@ -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.
|