ICU-6125 Eliminate a few kilobytes of unused bits in constant data structures.

X-SVN-Rev: 23182
This commit is contained in:
George Rhoten 2008-01-08 09:45:15 +00:00
parent 1d64a7d5b4
commit 9b82688642
9 changed files with 37 additions and 36 deletions

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 2000-2007, International Business Machines
* Copyright (C) 2000-2008, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* file name: ucnv2022.c
@ -344,7 +344,7 @@ static const char* const escSeqStateTable_Result_2022[MAX_STATES_2022] = {
#endif
static const UCNV_TableStates_2022 escSeqStateTable_Value_2022[MAX_STATES_2022] = {
static const int8_t escSeqStateTable_Value_2022[MAX_STATES_2022] = {
/* 0 1 2 3 4 5 6 7 8 9 */
VALID_NON_TERMINAL_2022 ,VALID_NON_TERMINAL_2022 ,VALID_NON_TERMINAL_2022 ,VALID_NON_TERMINAL_2022 ,VALID_NON_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_NON_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022
,VALID_MAYBE_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022 ,VALID_TERMINAL_2022
@ -671,7 +671,7 @@ _ISO2022getName(const UConverter* cnv){
* <ESC>$A GB2312
* <ESC>$(C KSC5601
*/
static const StateEnum nextStateToUnicodeJP[MAX_STATES_2022]= {
static const int8_t nextStateToUnicodeJP[MAX_STATES_2022]= {
/* 0 1 2 3 4 5 6 7 8 9 */
INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,SS2_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE
,ASCII ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,JISX201 ,HWKANA_7BIT ,JISX201 ,INVALID_STATE
@ -684,7 +684,7 @@ static const StateEnum nextStateToUnicodeJP[MAX_STATES_2022]= {
};
/*************** to unicode *******************/
static const StateEnum nextStateToUnicodeCN[MAX_STATES_2022]= {
static const int8_t nextStateToUnicodeCN[MAX_STATES_2022]= {
/* 0 1 2 3 4 5 6 7 8 9 */
INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,SS2_STATE ,SS3_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE
,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE ,INVALID_STATE
@ -1323,7 +1323,7 @@ static const char escSeqChars[][6] ={
"\x1B\x28\x49" /* <ESC>(I HWKANA_7BIT */
};
static const int32_t escSeqCharsLen[] ={
static const int8_t escSeqCharsLen[] ={
3, /* length of <ESC>(B ASCII */
3, /* length of <ESC>.A ISO-8859-1 */
3, /* length of <ESC>.F ISO-8859-7 */

View file

@ -1,7 +1,7 @@
/*
******************************************************************************
*
* Copyright (C) 2000-2007, International Business Machines
* Copyright (C) 2000-2008, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
@ -60,7 +60,7 @@
#define COMBINE (SHADDA+CSHADDA)
static const UChar IrrelevantPos[] = {
static const uint8_t IrrelevantPos[] = {
0x0, 0x2, 0x4, 0x6,
0x8, 0xA, 0xC, 0xE,
};
@ -165,7 +165,7 @@ static const UChar araLink[178]=
1, 1 /*0x06D2-0x06D3*/
};
static const UChar presALink[] = {
static const uint8_t presALink[] = {
/***********0*****1*****2*****3*****4*****5*****6*****7*****8*****9*****A*****B*****C*****D*****E*****F*/
/*FB5*/ 0, 1, 0, 0, 0, 0, 0, 1, 2,1 + 2, 0, 0, 0, 0, 0, 0,
/*FB6*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -187,7 +187,7 @@ static const UChar presALink[] = {
/*FC6*/ 4, 4, 4
};
static const UChar presBLink[]=
static const uint8_t presBLink[]=
{
/***********0*****1*****2*****3*****4*****5*****6*****7*****8*****9*****A*****B*****C*****D*****E*****F*/
/*FE7*/1 + 2,1 + 2,1 + 2, 0,1 + 2, 0,1 + 2,1 + 2,1 + 2,1 + 2,1 + 2,1 + 2,1 + 2,1 + 2,1 + 2,1 + 2,
@ -231,7 +231,7 @@ static const UChar convertFEto06[] =
/*FEF*/ 0x649, 0x64A, 0x64A, 0x64A, 0x64A, 0x65C, 0x65C, 0x65D, 0x65D, 0x65E, 0x65E, 0x65F, 0x65F
};
static const UChar shapeTable[4][4][4]=
static const uint8_t shapeTable[4][4][4]=
{
{ {0,0,0,0}, {0,0,0,0}, {0,1,0,3}, {0,1,0,1} },
{ {0,0,2,2}, {0,0,1,2}, {0,1,1,2}, {0,1,1,3} },

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 2005-2006, International Business Machines
* Copyright (C) 2005-2008, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*/
@ -19,7 +19,7 @@ U_NAMESPACE_BEGIN
#define min(x,y) (((x)<(y))?(x):(y))
const int32_t commonChars_sjis [] = {
const uint16_t commonChars_sjis [] = {
// TODO: This set of data comes from the character frequency-
// of-occurence analysis tool. The data needs to be moved
// into a resource and loaded from there.
@ -30,7 +30,7 @@ const int32_t commonChars_sjis [] = {
0x8343, 0x834e, 0x834f, 0x8358, 0x835e, 0x8362, 0x8367, 0x8375, 0x8376, 0x8389,
0x838a, 0x838b, 0x838d, 0x8393, 0x8e96, 0x93fa, 0x95aa};
const int32_t commonChars_euc_jp[] = {
const uint16_t commonChars_euc_jp[] = {
// TODO: This set of data comes from the character frequency-
// of-occurence analysis tool. The data needs to be moved
// into a resource and loaded from there.
@ -45,7 +45,7 @@ const int32_t commonChars_euc_jp[] = {
0xa5e5, 0xa5e9, 0xa5ea, 0xa5eb, 0xa5ec, 0xa5ed, 0xa5f3, 0xb8a9, 0xb9d4, 0xbaee,
0xbbc8, 0xbef0, 0xbfb7, 0xc4ea, 0xc6fc, 0xc7bd, 0xcab8, 0xcaf3, 0xcbdc, 0xcdd1};
const int32_t commonChars_euc_kr[] = {
const uint16_t commonChars_euc_kr[] = {
// TODO: This set of data comes from the character frequency-
// of-occurence analysis tool. The data needs to be moved
// into a resource and loaded from there.
@ -60,7 +60,7 @@ const int32_t commonChars_euc_kr[] = {
0xc0da, 0xc0e5, 0xc0fb, 0xc0fc, 0xc1a4, 0xc1a6, 0xc1b6, 0xc1d6, 0xc1df, 0xc1f6,
0xc1f8, 0xc4a1, 0xc5cd, 0xc6ae, 0xc7cf, 0xc7d1, 0xc7d2, 0xc7d8, 0xc7e5, 0xc8ad};
const int32_t commonChars_big5[] = {
const uint16_t commonChars_big5[] = {
// TODO: This set of data comes from the character frequency-
// of-occurence analysis tool. The data needs to be moved
// into a resource and loaded from there.
@ -75,7 +75,7 @@ const int32_t commonChars_big5[] = {
0xb5a5, 0xb5bd, 0xb5d0, 0xb5d8, 0xb671, 0xb7ed, 0xb867, 0xb944, 0xbad8, 0xbb44,
0xbba1, 0xbdd1, 0xc2c4, 0xc3b9, 0xc440, 0xc45f};
const int32_t commonChars_gb_18030[] = {
const uint16_t commonChars_gb_18030[] = {
// TODO: This set of data comes from the character frequency-
// of-occurence analysis tool. The data needs to be moved
// into a resource and loaded from there.
@ -90,7 +90,7 @@ const int32_t commonChars_gb_18030[] = {
0xcfb5, 0xcfc2, 0xcfd6, 0xd0c2, 0xd0c5, 0xd0d0, 0xd0d4, 0xd1a7, 0xd2aa, 0xd2b2,
0xd2b5, 0xd2bb, 0xd2d4, 0xd3c3, 0xd3d0, 0xd3fd, 0xd4c2, 0xd4da, 0xd5e2, 0xd6d0};
static int32_t binarySearch(const int32_t *array, int32_t len, int32_t value)
static int32_t binarySearch(const uint16_t *array, int32_t len, uint16_t value)
{
int32_t start = 0, end = len-1;
int32_t mid = (start+end)/2;
@ -142,7 +142,7 @@ CharsetRecog_mbcs::~CharsetRecog_mbcs()
// nothing to do.
}
int32_t CharsetRecog_mbcs::match_mbcs(InputText *det, const int32_t commonChars[], int32_t commonCharsLen) {
int32_t CharsetRecog_mbcs::match_mbcs(InputText *det, const uint16_t commonChars[], int32_t commonCharsLen) {
int singleByteCharCount = 0;
int doubleByteCharCount = 0;
int commonCharCount = 0;

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 2005-2007, International Business Machines
* Copyright (C) 2005-2008, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*/
@ -58,7 +58,7 @@ protected:
* <br/>
* bits 8-15: The match reason, an enum-like value.
*/
int32_t match_mbcs(InputText* det, const int32_t commonChars[], int32_t commonCharsLen);
int32_t match_mbcs(InputText* det, const uint16_t commonChars[], int32_t commonCharsLen);
public:

View file

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 1997-2007, International Business Machines Corporation and *
* Copyright (C) 1997-2008, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*
@ -224,7 +224,7 @@ DecimalFormatSymbols::initialize(const Locale& loc, UErrorCode& status,
void
DecimalFormatSymbols::initialize(const UChar** numberElements, int32_t *numberElementsStrLen, int32_t numberElementsLength)
{
static const int32_t TYPE_MAPPING[][2] = {
static const int8_t TYPE_MAPPING[][2] = {
{kDecimalSeparatorSymbol, 0},
{kGroupingSeparatorSymbol, 1},
{kPatternSeparatorSymbol, 2},

View file

@ -98,9 +98,9 @@ typedef enum dtStrEnum {
typedef struct dtTypeElem {
UChar patternChar;
UDateTimePatternField field;
int32_t type;
int32_t minLen;
int32_t weight;
int16_t type;
int16_t minLen;
int16_t weight;
}dtTypeElem;
class PtnSkeleton : public UMemory {

View file

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 1997-2007, International Business Machines Corporation and *
* Copyright (C) 1997-2008, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*
@ -57,13 +57,13 @@
* day number of January 1, 1970 (Gregorian calendar) at noon UTC. [LIU]
*/
static const int32_t kNumDays[]
static const int16_t kNumDays[]
= {0,31,59,90,120,151,181,212,243,273,304,334}; // 0-based, for day-in-year
static const int32_t kLeapNumDays[]
static const int16_t kLeapNumDays[]
= {0,31,60,91,121,152,182,213,244,274,305,335}; // 0-based, for day-in-year
static const int32_t kMonthLength[]
static const int8_t kMonthLength[]
= {31,28,31,30,31,30,31,31,30,31,30,31}; // 0-based
static const int32_t kLeapMonthLength[]
static const int8_t kLeapMonthLength[]
= {31,29,31,30,31,30,31,31,30,31,30,31}; // 0-based
// setTimeInMillis() limits the Julian day range to +/-7F000000.

View file

@ -1,6 +1,6 @@
/*
******************************************************************************
* Copyright (C) 2003-2007, International Business Machines Corporation
* Copyright (C) 2003-2008, International Business Machines Corporation
* and others. All Rights Reserved.
******************************************************************************
*
@ -69,7 +69,7 @@ static const int32_t LIMITS[UCAL_FIELD_COUNT][4] = {
* certain holidays fall on the sabbath, the year can end up being three
* different lengths, called "deficient", "normal", and "complete".
*/
static const int32_t MONTH_LENGTH[][3] = {
static const int8_t MONTH_LENGTH[][3] = {
// Deficient Normal Complete
{ 30, 30, 30 }, //Tishri
{ 29, 29, 30 }, //Heshvan
@ -92,7 +92,7 @@ static const int32_t MONTH_LENGTH[][3] = {
* keeping it around separately makes some calculations a lot faster
*/
static const int32_t MONTH_START[][3] = {
static const int16_t MONTH_START[][3] = {
// Deficient Normal Complete
{ 0, 0, 0 }, // (placeholder)
{ 30, 30, 30 }, // Tishri
@ -113,7 +113,7 @@ static const int32_t MONTH_START[][3] = {
/**
* The cumulative # of days to the end of each month in a leap year
*/
static const int32_t LEAP_MONTH_START[][3] = {
static const int16_t LEAP_MONTH_START[][3] = {
// Deficient Normal Complete
{ 0, 0, 0 }, // (placeholder)
{ 30, 30, 30 }, // Tishri

View file

@ -1,5 +1,6 @@
/*
* Copyright (C) 2003-2007, International Business Machines Corporation
******************************************************************************
* Copyright (C) 2003-2008, International Business Machines Corporation
* and others. All Rights Reserved.
******************************************************************************
*
@ -15,7 +16,7 @@
#if !UCONFIG_NO_FORMATTING
static const int monthDays[] = { 31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29 };
static const int8_t monthDays[] = { 31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29 };
static int32_t
jalali_to_julian(int year, int month, int day)