diff --git a/icu4c/source/common/ucase.cpp b/icu4c/source/common/ucase.cpp index 3763e1e6514..96d3e5d131b 100644 --- a/icu4c/source/common/ucase.cpp +++ b/icu4c/source/common/ucase.cpp @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 2004-2011, International Business Machines +* Copyright (C) 2004-2012, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -403,16 +403,7 @@ ucase_getType(const UCaseProps *csp, UChar32 c) { U_CAPI int32_t U_EXPORT2 ucase_getTypeOrIgnorable(const UCaseProps *csp, UChar32 c) { uint16_t props=UTRIE2_GET16(&csp->trie, c); - int32_t type=UCASE_GET_TYPE(props); - if(props&UCASE_EXCEPTION) { - const uint16_t *pe=GET_EXCEPTIONS(csp, props); - if(*pe&UCASE_EXC_CASE_IGNORABLE) { - type|=4; - } - } else if(type==UCASE_NONE && (props&UCASE_CASE_IGNORABLE)) { - type|=4; - } - return type; + return UCASE_GET_TYPE_AND_IGNORABLE(props); } /** @return UCASE_NO_DOT, UCASE_SOFT_DOTTED, UCASE_ABOVE, UCASE_OTHER_ACCENT */ diff --git a/icu4c/source/common/ucase.h b/icu4c/source/common/ucase.h index a2a93cc2cb6..75594724687 100644 --- a/icu4c/source/common/ucase.h +++ b/icu4c/source/common/ucase.h @@ -278,37 +278,36 @@ enum { }; #define UCASE_GET_TYPE(props) ((props)&UCASE_TYPE_MASK) +#define UCASE_GET_TYPE_AND_IGNORABLE(props) ((props)&7) -#define UCASE_SENSITIVE 4 -#define UCASE_EXCEPTION 8 +#define UCASE_IGNORABLE 4 +#define UCASE_SENSITIVE 8 +#define UCASE_EXCEPTION 0x10 -#define UCASE_DOT_MASK 0x30 +#define UCASE_DOT_MASK 0x60 enum { UCASE_NO_DOT=0, /* normal characters with cc=0 */ - UCASE_SOFT_DOTTED=0x10, /* soft-dotted characters with cc=0 */ - UCASE_ABOVE=0x20, /* "above" accents with cc=230 */ - UCASE_OTHER_ACCENT=0x30 /* other accent character (0>UCASE_DELTA_SHIFT) #else -# define UCASE_GET_DELTA(props) (int16_t)(((props)&0x8000) ? (((props)>>UCASE_DELTA_SHIFT)|0xfc00) : ((uint16_t)(props)>>UCASE_DELTA_SHIFT)) +# define UCASE_GET_DELTA(props) (int16_t)(((props)&0x8000) ? (((props)>>UCASE_DELTA_SHIFT)|0xfe00) : ((uint16_t)(props)>>UCASE_DELTA_SHIFT)) #endif -/* case-ignorable uses one of the delta bits, see genprops/casepropsbuilder.cpp */ -#define UCASE_CASE_IGNORABLE 0x40 - -/* exception: bits 15..4 are an unsigned 12-bit index into the exceptions array */ -#define UCASE_EXC_SHIFT 4 -#define UCASE_EXC_MASK 0xfff0 -#define UCASE_MAX_EXCEPTIONS 0x1000 +/* exception: bits 15..5 are an unsigned 11-bit index into the exceptions array */ +#define UCASE_EXC_SHIFT 5 +#define UCASE_EXC_MASK 0xffe0 +#define UCASE_MAX_EXCEPTIONS ((UCASE_EXC_MASK>>UCASE_EXC_SHIFT)+1) /* definitions for 16-bit main exceptions word ------------------------------ */ @@ -328,12 +327,10 @@ enum { /* each slot is 2 uint16_t instead of 1 */ #define UCASE_EXC_DOUBLE_SLOTS 0x100 -/* reserved: exception bits 10..9 */ - -#define UCASE_EXC_CASE_IGNORABLE 0x800 +/* reserved: exception bits 11..9 */ /* UCASE_EXC_DOT_MASK=UCASE_DOT_MASK<formatVersion[0]==1 && pInfo->formatVersion[2]==UTRIE_SHIFT && pInfo->formatVersion[3]==UTRIE_INDEX_SHIFT) || - pInfo->formatVersion[0]==2) + pInfo->formatVersion[0]==2 || pInfo->formatVersion[0]==3) )) { udata_printError(ds, "ucase_swap(): data format %02x.%02x.%02x.%02x (format version %02x) is not recognized as case mapping data\n", pInfo->dataFormat[0], pInfo->dataFormat[1],