From b601fb3a3e0799d744f3eff61449d79ffbb6417d Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Thu, 26 Aug 2010 11:05:46 +0800 Subject: re-factor pinyin phrase --- src/storage/pinyin_phrase.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/storage/pinyin_phrase.h') 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 &lhs, const PinyinIndexItem &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 &lhs, const PinyinIndexItem &rhs) const{ - return -1 == m_compare(lhs, rhs); + return 0 > m_compare(lhs, rhs); } }; */ -- cgit