diff options
author | Peng Wu <alexepico@gmail.com> | 2010-08-26 11:05:46 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2010-08-26 11:05:46 +0800 |
commit | b601fb3a3e0799d744f3eff61449d79ffbb6417d (patch) | |
tree | 9e0b7653d2f5d0dec1a411c6adf1562a1fea1f8d /src/storage/pinyin_phrase.h | |
parent | c7232e9e4545596913892f478405b8e8febc6e4b (diff) | |
download | libpinyin-b601fb3a3e0799d744f3eff61449d79ffbb6417d.tar.gz libpinyin-b601fb3a3e0799d744f3eff61449d79ffbb6417d.tar.xz libpinyin-b601fb3a3e0799d744f3eff61449d79ffbb6417d.zip |
re-factor pinyin phrase
Diffstat (limited to 'src/storage/pinyin_phrase.h')
-rw-r--r-- | src/storage/pinyin_phrase.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/storage/pinyin_phrase.h b/src/storage/pinyin_phrase.h index 25863d2..9ce2c3f 100644 --- a/src/storage/pinyin_phrase.h +++ b/src/storage/pinyin_phrase.h @@ -27,6 +27,7 @@ namespace novel{ +/* static inline int pinyin_utility_sign(int value){ if(value > 0) return 1; @@ -34,6 +35,7 @@ static inline int pinyin_utility_sign(int value){ return -1; else return 0; } +*/ inline int pinyin_exact_compare(const PinyinKey key_lhs[], const PinyinKey key_rhs[], @@ -43,17 +45,17 @@ inline int pinyin_exact_compare(const PinyinKey key_lhs[], for ( i = 0 ; i < phrase_length ; i++){ result = key_lhs[i].m_initial - key_rhs[i].m_initial; if ( result != 0 ) - return pinyin_utility_sign(result); + return result; } for( i = 0 ; i < phrase_length ; i++){ result = key_lhs[i].m_final - key_rhs[i].m_final; if ( result != 0 ) - return pinyin_utility_sign(result); + return result; } for( i = 0 ; i < phrase_length ; i++){ result = key_lhs[i].m_tone - key_rhs[i].m_tone; if ( result != 0 ) - return pinyin_utility_sign(result); + return result; } return 0; } @@ -269,7 +271,7 @@ class PhraseExactLessThan public: bool operator () (const PinyinIndexItem<phrase_length> &lhs, const PinyinIndexItem<phrase_length> &rhs) const{ - return -1 == m_compare(lhs, rhs); + return 0 > m_compare(lhs, rhs); } }; @@ -285,7 +287,7 @@ class PhraseExactLessThanWithToken public: bool operator () (const PinyinIndexItem<phrase_length> &lhs, const PinyinIndexItem<phrase_length> &rhs) const{ - return -1 == m_compare(lhs, rhs); + return 0 > m_compare(lhs, rhs); } }; */ |