diff --git a/icu4c/source/common/unicode/utext.h b/icu4c/source/common/unicode/utext.h index c21d636f151..84aeb68afeb 100644 --- a/icu4c/source/common/unicode/utext.h +++ b/icu4c/source/common/unicode/utext.h @@ -1163,6 +1163,13 @@ struct UTextFuncs { * Intended for use should the table grow to accomodate added * functions in the future, to allow tests for older format * function tables that do not contain the extensions. + * + * Fields are placed for optimal alignment on + * 32/64/128-bit-pointer machines, by normally grouping together + * 4 32-bit fields, + * 4 pointers, + * 2 64-bit fields + * in sequence. * @draft ICU 3.6 */ int32_t tableSize; @@ -1172,7 +1179,7 @@ struct UTextFuncs { * Do not use, reserved for use by the UText framework only. * @internal */ - int32_t reserved; + int32_t reserved1, reserved2, reserved3; /** @@ -1266,12 +1273,6 @@ struct UTextFuncs { */ UTextClose *spare3; - /** - * (private) Spare function pointer - * @internal - */ - UTextClose *spare4; - }; typedef struct UTextFuncs UTextFuncs; @@ -1355,6 +1356,12 @@ struct UText { /* ---- 16 byte alignment boundary------ */ + /** + * (protected) Native index of the first character in the text chunk. + * @draft ICU 3.6 + */ + int64_t chunkNativeStart; + /** * (protected) Current iteration position within the text chunk (UTF-16 buffer). * This is the index to the character that will be returned by utext_next32(). @@ -1368,12 +1375,6 @@ struct UText { */ int32_t chunkLength; - /** - * (protected) Native index of the first character in the text chunk. - * @draft ICU 3.6 - */ - int64_t chunkNativeStart; - /* ---- 16 byte alignment boundary-- */ @@ -1528,9 +1529,9 @@ enum { 0, /* chunkNativeLimit */ \ 0, /* extraSize */ \ 0, /* nativeIndexingLimit */ \ + 0, /* chunkNativeStart */ \ 0, /* chunkOffset */ \ 0, /* chunkLength */ \ - 0, /* chunkNativeStart */ \ NULL, /* chunkContents */ \ NULL, /* pFuncs */ \ NULL, /* pExtra */ \ diff --git a/icu4c/source/common/utext.cpp b/icu4c/source/common/utext.cpp index 5eefb5933d5..da496cd01b0 100644 --- a/icu4c/source/common/utext.cpp +++ b/icu4c/source/common/utext.cpp @@ -1584,7 +1584,7 @@ U_CDECL_END static struct UTextFuncs utf8Funcs = { sizeof(UTextFuncs), - 0, // Reserved alignment padding + 0, 0, 0, // Reserved alignment padding utf8TextClone, utf8TextLength, utf8TextAccess, @@ -1596,8 +1596,7 @@ static struct UTextFuncs utf8Funcs = utf8TextClose, NULL, // spare 1 NULL, // spare 2 - NULL, // spare 3 - NULL // spare 4 + NULL // spare 3 }; @@ -1986,7 +1985,7 @@ repTextCopy(UText *ut, static struct UTextFuncs repFuncs = { sizeof(UTextFuncs), - 0, // Reserved alignment padding + 0, 0, 0, // Reserved alignment padding repTextClone, repTextLength, repTextAccess, @@ -1998,8 +1997,7 @@ static struct UTextFuncs repFuncs = repTextClose, NULL, // spare 1 NULL, // spare 2 - NULL, // spare 3 - NULL // spare 4 + NULL // spare 3 }; @@ -2235,7 +2233,7 @@ unistrTextCopy(UText *ut, static struct UTextFuncs unistrFuncs = { sizeof(UTextFuncs), - 0, // Reserved alignment padding + 0, 0, 0, // Reserved alignment padding unistrTextClone, unistrTextLength, unistrTextAccess, @@ -2247,8 +2245,7 @@ static struct UTextFuncs unistrFuncs = unistrTextClose, NULL, // spare 1 NULL, // spare 2 - NULL, // spare 3 - NULL // spare 4 + NULL // spare 3 }; @@ -2547,7 +2544,7 @@ ucstrTextExtract(UText *ut, static struct UTextFuncs ucstrFuncs = { sizeof(UTextFuncs), - 0, // Reserved alignment padding + 0, 0, 0, // Reserved alignment padding ucstrTextClone, ucstrTextLength, ucstrTextAccess, @@ -2560,7 +2557,6 @@ static struct UTextFuncs ucstrFuncs = NULL, // spare 1 NULL, // spare 2 NULL, // spare 3 - NULL // spare 4 }; U_CDECL_END @@ -2762,20 +2758,19 @@ charIterTextExtract(UText *ut, static struct UTextFuncs charIterFuncs = { sizeof(UTextFuncs), - 0, // Reserved alignment padding + 0, 0, 0, // Reserved alignment padding charIterTextClone, charIterTextLength, charIterTextAccess, charIterTextExtract, - NULL, // Replace - NULL, // Copy - NULL, // MapOffsetToNative, - NULL, // MapIndexToUTF16, + NULL, // Replace + NULL, // Copy + NULL, // MapOffsetToNative, + NULL, // MapIndexToUTF16, charIterTextClose, NULL, // spare 1 NULL, // spare 2 - NULL, // spare 3 - NULL // spare 4 + NULL // spare 3 }; U_CDECL_END