OLD | NEW |
1 /* | 1 /* |
2 ******************************************************************************* | 2 ******************************************************************************* |
3 * Copyright (C) 2010-2014, International Business Machines | 3 * Copyright (C) 2010-2014, International Business Machines |
4 * Corporation and others. All Rights Reserved. | 4 * Corporation and others. All Rights Reserved. |
5 ******************************************************************************* | 5 ******************************************************************************* |
6 * collation.cpp | 6 * collation.cpp |
7 * | 7 * |
8 * created on: 2010oct27 | 8 * created on: 2010oct27 |
9 * created by: Markus W. Scherer | 9 * created by: Markus W. Scherer |
10 */ | 10 */ |
11 | 11 |
12 #include "unicode/utypes.h" | 12 #include "unicode/utypes.h" |
13 | 13 |
14 #if !UCONFIG_NO_COLLATION | 14 #if !UCONFIG_NO_COLLATION |
15 | 15 |
16 #include "collation.h" | 16 #include "collation.h" |
17 #include "uassert.h" | 17 #include "uassert.h" |
18 | 18 |
19 U_NAMESPACE_BEGIN | 19 U_NAMESPACE_BEGIN |
20 | 20 |
21 // Some compilers don't care if constants are defined in the .cpp file. | 21 // Some compilers don't care if constants are defined in the .cpp file. |
22 // MS Visual C++ does not like it, but gcc requires it. clang does not care. | 22 // MS Visual C++ does not like it, but gcc requires it. clang does not care. |
23 #ifndef _MSC_VER | 23 #ifndef _MSC_VER |
| 24 const uint8_t Collation::LEVEL_SEPARATOR_BYTE; |
| 25 const uint8_t Collation::MERGE_SEPARATOR_BYTE; |
24 const uint32_t Collation::ONLY_TERTIARY_MASK; | 26 const uint32_t Collation::ONLY_TERTIARY_MASK; |
25 const uint32_t Collation::CASE_AND_TERTIARY_MASK; | 27 const uint32_t Collation::CASE_AND_TERTIARY_MASK; |
26 #endif | 28 #endif |
27 | 29 |
28 uint32_t | 30 uint32_t |
29 Collation::incTwoBytePrimaryByOffset(uint32_t basePrimary, UBool isCompressible,
int32_t offset) { | 31 Collation::incTwoBytePrimaryByOffset(uint32_t basePrimary, UBool isCompressible,
int32_t offset) { |
30 // Extract the second byte, minus the minimum byte value, | 32 // Extract the second byte, minus the minimum byte value, |
31 // plus the offset, modulo the number of usable byte values, plus the minimu
m. | 33 // plus the offset, modulo the number of usable byte values, plus the minimu
m. |
32 // Reserve the PRIMARY_COMPRESSION_LOW_BYTE and high byte if necessary. | 34 // Reserve the PRIMARY_COMPRESSION_LOW_BYTE and high byte if necessary. |
33 uint32_t primary; | 35 uint32_t primary; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 c /= 254; | 139 c /= 254; |
138 // Second byte: 251 values 04..FE excluding the primary compression bytes. | 140 // Second byte: 251 values 04..FE excluding the primary compression bytes. |
139 primary |= (4 + (c % 251)) << 16; | 141 primary |= (4 + (c % 251)) << 16; |
140 // One lead byte covers all code points (c < 0x1182B4 = 1*251*254*18). | 142 // One lead byte covers all code points (c < 0x1182B4 = 1*251*254*18). |
141 return primary | (UNASSIGNED_IMPLICIT_BYTE << 24); | 143 return primary | (UNASSIGNED_IMPLICIT_BYTE << 24); |
142 } | 144 } |
143 | 145 |
144 U_NAMESPACE_END | 146 U_NAMESPACE_END |
145 | 147 |
146 #endif // !UCONFIG_NO_COLLATION | 148 #endif // !UCONFIG_NO_COLLATION |
OLD | NEW |