diff options
author | Peng Wu <alexepico@gmail.com> | 2016-01-08 12:36:53 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2016-01-08 12:36:53 +0800 |
commit | 96ca8abf09bd53ed62ed5be347d5243e9ce9f154 (patch) | |
tree | 506be27ac752eeaee2147a7510e2cd8b7562e31c /src/storage/pinyin_phrase3.h | |
parent | c253c4fcbf2a9b49224a825f5e5dcffcb412d0a0 (diff) | |
download | libpinyin-96ca8abf09bd53ed62ed5be347d5243e9ce9f154.tar.gz libpinyin-96ca8abf09bd53ed62ed5be347d5243e9ce9f154.tar.xz libpinyin-96ca8abf09bd53ed62ed5be347d5243e9ce9f154.zip |
refactor code
Diffstat (limited to 'src/storage/pinyin_phrase3.h')
-rw-r--r-- | src/storage/pinyin_phrase3.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/storage/pinyin_phrase3.h b/src/storage/pinyin_phrase3.h index b99bc15..6ce1698 100644 --- a/src/storage/pinyin_phrase3.h +++ b/src/storage/pinyin_phrase3.h @@ -60,6 +60,23 @@ inline int pinyin_exact_compare2(const ChewingKey * key_lhs, return 0; } +/* for find the element in the phrase array */ +template<size_t phrase_length> +inline int phrase_exact_compare2(const PinyinIndexItem2<phrase_length> &lhs, + const PinyinIndexItem2<phrase_length> &rhs) +{ + ChewingKey * keys_lhs = (ChewingKey *) lhs.m_keys; + ChewingKey * keys_rhs = (ChewingKey *) rhs.m_keys; + return pinyin_exact_compare2(keys_lhs, keys_rhs, phrase_length); +} + +template<size_t phrase_length> +inline bool phrase_exact_less_than2(const PinyinIndexItem2<phrase_length> &lhs, + const PinyinIndexItem2<phrase_length> &rhs) +{ + return 0 > phrase_exact_compare2<phrase_length>(lhs, rhs); +} + }; |