| OLD | NEW |
| 1 /* | 1 /* |
| 2 ******************************************************************************* | 2 ******************************************************************************* |
| 3 * Copyright (C) 2013-2014, International Business Machines | 3 * Copyright (C) 2013-2014, International Business Machines |
| 4 * Corporation and others. All Rights Reserved. | 4 * Corporation and others. All Rights Reserved. |
| 5 ******************************************************************************* | 5 ******************************************************************************* |
| 6 * collationfastlatin.cpp | 6 * collationfastlatin.cpp |
| 7 * | 7 * |
| 8 * created on: 2013aug18 | 8 * created on: 2013aug18 |
| 9 * created by: Markus W. Scherer | 9 * created by: Markus W. Scherer |
| 10 */ | 10 */ |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 uint32_t miniVarTop; | 33 uint32_t miniVarTop; |
| 34 if((settings.options & CollationSettings::ALTERNATE_MASK) == 0) { | 34 if((settings.options & CollationSettings::ALTERNATE_MASK) == 0) { |
| 35 // No mini primaries are variable, set a variableTop just below the | 35 // No mini primaries are variable, set a variableTop just below the |
| 36 // lowest long mini primary. | 36 // lowest long mini primary. |
| 37 miniVarTop = MIN_LONG - 1; | 37 miniVarTop = MIN_LONG - 1; |
| 38 } else { | 38 } else { |
| 39 uint32_t v1 = settings.variableTop >> 24; | 39 uint32_t v1 = settings.variableTop >> 24; |
| 40 int32_t headerLength = *table & 0xff; | 40 int32_t headerLength = *table & 0xff; |
| 41 int32_t i = headerLength - 1; | 41 int32_t i = headerLength - 1; |
| 42 if(i <= 0 || v1 > (table[i] & 0x7f)) { | 42 if(i <= 0 || v1 > (table[i] & 0x7fu)) { |
| 43 return -1; // variableTop >= digits, should not occur | 43 return -1; // variableTop >= digits, should not occur |
| 44 } | 44 } |
| 45 while(i > 1 && v1 <= (table[i - 1] & 0x7f)) { --i; } | 45 while(i > 1 && v1 <= (table[i - 1] & 0x7fu)) { --i; } |
| 46 // In the table header, the miniVarTop is in bits 15..7, with 4 zero bit
s 19..16 implied. | 46 // In the table header, the miniVarTop is in bits 15..7, with 4 zero bit
s 19..16 implied. |
| 47 // Shift right to make it comparable with long mini primaries in bits 15
..3. | 47 // Shift right to make it comparable with long mini primaries in bits 15
..3. |
| 48 miniVarTop = (table[i] & 0xff80) >> 4; | 48 miniVarTop = (table[i] & 0xff80) >> 4; |
| 49 } | 49 } |
| 50 | 50 |
| 51 const uint8_t *reorderTable = settings.reorderTable; | 51 const uint8_t *reorderTable = settings.reorderTable; |
| 52 if(reorderTable != NULL) { | 52 if(reorderTable != NULL) { |
| 53 const uint16_t *scripts = data->scripts; | 53 const uint16_t *scripts = data->scripts; |
| 54 int32_t length = data->scriptsLength; | 54 int32_t length = data->scriptsLength; |
| 55 uint32_t prevLastByte = 0; | 55 uint32_t prevLastByte = 0; |
| (...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 U_ASSERT(ce >= MIN_LONG); | 1074 U_ASSERT(ce >= MIN_LONG); |
| 1075 pair &= TWO_LONG_PRIMARIES_MASK; // variable | 1075 pair &= TWO_LONG_PRIMARIES_MASK; // variable |
| 1076 } | 1076 } |
| 1077 } | 1077 } |
| 1078 return pair; | 1078 return pair; |
| 1079 } | 1079 } |
| 1080 | 1080 |
| 1081 U_NAMESPACE_END | 1081 U_NAMESPACE_END |
| 1082 | 1082 |
| 1083 #endif // !UCONFIG_NO_COLLATION | 1083 #endif // !UCONFIG_NO_COLLATION |
| OLD | NEW |