summaryrefslogtreecommitdiffstats
path: root/src/storage/pinyin_phrase3.h
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2016-01-08 12:36:53 +0800
committerPeng Wu <alexepico@gmail.com>2016-01-08 12:36:53 +0800
commit96ca8abf09bd53ed62ed5be347d5243e9ce9f154 (patch)
tree506be27ac752eeaee2147a7510e2cd8b7562e31c /src/storage/pinyin_phrase3.h
parentc253c4fcbf2a9b49224a825f5e5dcffcb412d0a0 (diff)
downloadlibpinyin-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.h17
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);
+}
+
};