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_base.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/storage/pinyin_base.cpp') diff --git a/src/storage/pinyin_base.cpp b/src/storage/pinyin_base.cpp index 90a0baa..66587f0 100644 --- a/src/storage/pinyin_base.cpp +++ b/src/storage/pinyin_base.cpp @@ -1384,8 +1384,7 @@ int pinyin_compare_initial (const PinyinCustomSettings &custom, (lhs == PINYIN_He && rhs == PINYIN_Fo))) ) return 0; - else if (lhs < rhs) return -1; - return 1; + else return (lhs - rhs); } int pinyin_compare_final (const PinyinCustomSettings &custom, @@ -1407,8 +1406,7 @@ int pinyin_compare_final (const PinyinCustomSettings &custom, return 0; else if (custom.use_incomplete && (lhs == PINYIN_ZeroFinal || rhs == PINYIN_ZeroFinal)) return 0; - else if (lhs < rhs) return -1; - return 1; + else return (lhs - rhs); } int pinyin_compare_tone (const PinyinCustomSettings &custom, @@ -1417,8 +1415,7 @@ int pinyin_compare_tone (const PinyinCustomSettings &custom, { if(lhs == rhs || !lhs || !rhs) return 0; - else if (lhs < rhs) return -1; - return 1; + else return (lhs - rhs); } }; -- cgit