diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/storage/phrase_large_table2.h | 35 | ||||
-rw-r--r-- | src/storage/phrase_large_table3.h | 36 |
2 files changed, 36 insertions, 35 deletions
diff --git a/src/storage/phrase_large_table2.h b/src/storage/phrase_large_table2.h index cf6807c..bc94eed 100644 --- a/src/storage/phrase_large_table2.h +++ b/src/storage/phrase_large_table2.h @@ -117,41 +117,6 @@ public: }; -static inline int reduce_tokens(const PhraseTokens tokens, - TokenVector tokenarray) { - int num = 0; - g_array_set_size(tokenarray, 0); - - for (size_t i = 0; i < PHRASE_INDEX_LIBRARY_COUNT; ++i) { - GArray * array = tokens[i]; - if (NULL == array) - continue; - - num += array->len; - - g_array_append_vals(tokenarray, array->data, array->len); - } - - /* the following line will be removed in future after code are verified. */ - assert(0 <= num && num <= 4); - - return num; -} - -/* for compatibility. */ -static inline int get_first_token(const PhraseTokens tokens, - /* out */ phrase_token_t & token){ - token = null_token; - - TokenVector tokenarray = g_array_new(FALSE, FALSE, sizeof(phrase_token_t)); - int num = reduce_tokens(tokens, tokenarray); - if (num) - token = g_array_index(tokenarray, phrase_token_t, 0); - g_array_free(tokenarray, TRUE); - - return num; -} - }; #endif diff --git a/src/storage/phrase_large_table3.h b/src/storage/phrase_large_table3.h index 51cbf20..1bd450d 100644 --- a/src/storage/phrase_large_table3.h +++ b/src/storage/phrase_large_table3.h @@ -75,6 +75,42 @@ public: bool mask_out(phrase_token_t mask, phrase_token_t value); }; +static inline int reduce_tokens(const PhraseTokens tokens, + TokenVector tokenarray) { + int num = 0; + g_array_set_size(tokenarray, 0); + + for (size_t i = 0; i < PHRASE_INDEX_LIBRARY_COUNT; ++i) { + GArray * array = tokens[i]; + if (NULL == array) + continue; + + num += array->len; + + g_array_append_vals(tokenarray, array->data, array->len); + } + + /* the following line will be removed in future after code are verified. */ + assert(0 <= num && num <= 4); + + return num; +} + +/* for compatibility. */ +static inline int get_first_token(const PhraseTokens tokens, + /* out */ phrase_token_t & token){ + token = null_token; + + TokenVector tokenarray = g_array_new(FALSE, FALSE, sizeof(phrase_token_t)); + int num = reduce_tokens(tokens, tokenarray); + if (num) + token = g_array_index(tokenarray, phrase_token_t, 0); + g_array_free(tokenarray, TRUE); + + return num; +} + + }; #endif |