From c8a748528c0dc071d72c41f4ec2e28e6b46c412f Mon Sep 17 00:00:00 2001 From: Alan Liu Date: Tue, 19 Sep 2000 16:33:22 +0000 Subject: [PATCH] ICU-564 add aliasing init functions X-SVN-Rev: 2446 --- icu4c/source/common/ucmp16.c | 18 ++++++++++++++++++ icu4c/source/common/ucmp16.h | 9 ++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/icu4c/source/common/ucmp16.c b/icu4c/source/common/ucmp16.c index 45e561bd30..f2f73dd142 100644 --- a/icu4c/source/common/ucmp16.c +++ b/icu4c/source/common/ucmp16.c @@ -306,6 +306,24 @@ CompactShortArray* ucmp16_initAlias(CompactShortArray *this_obj, return this_obj; } +CompactShortArray* ucmp16_initAliasWithBlockShift(CompactShortArray *this_obj, + uint16_t *indexArray, + int16_t *newValues, + int32_t count, + int16_t defaultValue, + int32_t blockShift) +{ + ucmp16_initAlias(this_obj, indexArray, newValues, count, defaultValue); + + if (this_obj) { + this_obj->kBlockShift = blockShift; + this_obj->kBlockMask = (uint32_t) (((uint32_t)1 << (uint32_t)blockShift) - (uint32_t)1); + } + + return this_obj; +} + + /*=======================================================*/ void ucmp16_close(CompactShortArray* this_obj) diff --git a/icu4c/source/common/ucmp16.h b/icu4c/source/common/ucmp16.h index bbcb701a07..8b2b8e70ff 100644 --- a/icu4c/source/common/ucmp16.h +++ b/icu4c/source/common/ucmp16.h @@ -70,7 +70,7 @@ * @see CompactIntArray * @see CompactCharArray * @see CompactStringArray - * @version $Revision: 1.12 $ 8/25/98 + * @version $Revision: 1.13 $ 8/25/98 * @author Helena Shih */ @@ -162,6 +162,13 @@ U_CAPI CompactShortArray* U_EXPORT2 ucmp16_initAlias(CompactShortArray *this_ob int16_t defaultValue ); +U_CAPI CompactShortArray* U_EXPORT2 ucmp16_initAliasWithBlockShift(CompactShortArray *this_obj, + uint16_t *indexArray, + int16_t *newValues, + int32_t count, + int16_t defaultValue, + int32_t blockShift); + U_CAPI void U_EXPORT2 ucmp16_close(CompactShortArray* array); /** * Returns TRUE if the creation of the compact array fails.