Skip to content

Commit

Permalink
ICU-22991 Remove unused private fIsSet
Browse files Browse the repository at this point in the history
This field is removed in Java 24 years ago. Save 24 bytes per Calendar
object.
  • Loading branch information
FrankYFTang committed Dec 23, 2024
1 parent e515c84 commit 841e88b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 15 deletions.
8 changes: 0 additions & 8 deletions icu4c/source/i18n/calendar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,6 @@ Calendar::operator=(const Calendar &right)
{
if (this != &right) {
uprv_arrayCopy(right.fFields, fFields, UCAL_FIELD_COUNT);
uprv_arrayCopy(right.fIsSet, fIsSet, UCAL_FIELD_COUNT);
uprv_arrayCopy(right.fStamp, fStamp, UCAL_FIELD_COUNT);
fTime = right.fTime;
fIsTimeSet = right.fIsTimeSet;
Expand Down Expand Up @@ -1170,7 +1169,6 @@ Calendar::setTimeInMillis( double millis, UErrorCode& status ) {
for (int32_t i=0; i<UCAL_FIELD_COUNT; ++i) {
fFields[i] = 0;
fStamp[i] = kUnset;
fIsSet[i] = false;
}


Expand Down Expand Up @@ -1213,7 +1211,6 @@ Calendar::set(UCalendarDateFields field, int32_t value)
recalculateStamp();
}
fStamp[field] = fNextStamp++;
fIsSet[field] = true; // Remove later
fIsTimeSet = fAreFieldsSet = fAreFieldsVirtuallySet = false;
}

Expand Down Expand Up @@ -1273,7 +1270,6 @@ Calendar::clear()
for (int32_t i=0; i<UCAL_FIELD_COUNT; ++i) {
fFields[i] = 0; // Must do this; other code depends on it
fStamp[i] = kUnset;
fIsSet[i] = false; // Remove later
}
fIsTimeSet = fAreFieldsSet = fAreAllFieldsSet = fAreFieldsVirtuallySet = false;
// fTime is not 'cleared' - may be used if no fields are set.
Expand All @@ -1296,12 +1292,10 @@ Calendar::clear(UCalendarDateFields field)
if (field == UCAL_MONTH) {
fFields[UCAL_ORDINAL_MONTH] = 0;
fStamp[UCAL_ORDINAL_MONTH] = kUnset;
fIsSet[UCAL_ORDINAL_MONTH] = false; // Remove later
}
if (field == UCAL_ORDINAL_MONTH) {
fFields[UCAL_MONTH] = 0;
fStamp[UCAL_MONTH] = kUnset;
fIsSet[UCAL_MONTH] = false; // Remove later
}
fIsTimeSet = fAreFieldsSet = fAreAllFieldsSet = fAreFieldsVirtuallySet = false;
}
Expand Down Expand Up @@ -1434,10 +1428,8 @@ void Calendar::computeFields(UErrorCode &ec)
for (int32_t i=0; i<UCAL_FIELD_COUNT; ++i) {
if ((mask & 1) == 0) {
fStamp[i] = kInternallySet;
fIsSet[i] = true; // Remove later
} else {
fStamp[i] = kUnset;
fIsSet[i] = false; // Remove later
}
mask >>= 1;
}
Expand Down
7 changes: 0 additions & 7 deletions icu4c/source/i18n/unicode/calendar.h
Original file line number Diff line number Diff line change
Expand Up @@ -1937,12 +1937,6 @@ class U_I18N_API Calendar : public UObject {
*/
int32_t fFields[UCAL_FIELD_COUNT];

private:
/**
* The flags which tell if a specified time field for the calendar is set.
*/
UBool fIsSet[UCAL_FIELD_COUNT];

protected:
/** Special values of stamp[]
* @stable ICU 2.0
Expand Down Expand Up @@ -2552,7 +2546,6 @@ Calendar::internalSet(UCalendarDateFields field, int32_t value)
{
fFields[field] = value;
fStamp[field] = kInternallySet;
fIsSet[field] = true; // Remove later
}

/**
Expand Down

0 comments on commit 841e88b

Please sign in to comment.