From 3226c52b086bbbe52452c9d2efb63a5635a60c5e Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Wed, 5 Mar 2014 23:11:07 +0000 Subject: [PATCH] ICU-10756 fix operator= ( restores performance for the createInstance() / applyPattern("#") case ) X-SVN-Rev: 35348 --- icu4c/source/i18n/dcfmtimp.h | 11 ++++++++--- icu4c/source/i18n/decimfmt.cpp | 6 ++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/icu4c/source/i18n/dcfmtimp.h b/icu4c/source/i18n/dcfmtimp.h index 4256fd07618..0f27a8d9478 100644 --- a/icu4c/source/i18n/dcfmtimp.h +++ b/icu4c/source/i18n/dcfmtimp.h @@ -1,6 +1,6 @@ /* ******************************************************************************** -* Copyright (C) 2012, International Business Machines +* Copyright (C) 2012-2014, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************************/ @@ -26,7 +26,12 @@ enum EDecimalFormatFastpathStatus { struct DecimalFormatInternal { uint8_t fFastFormatStatus; uint8_t fFastParseStatus; - + + DecimalFormatInternal &operator=(const DecimalFormatInternal& rhs) { + fFastParseStatus = rhs.fFastParseStatus; + fFastFormatStatus = rhs.fFastFormatStatus; + return *this; + } #ifdef FMT_DEBUG void dump() const { printf("DecimalFormatInternal: fFastFormatStatus=%c, fFastParseStatus=%c\n", @@ -34,7 +39,7 @@ struct DecimalFormatInternal { "NY?"[(int)fFastParseStatus&3] ); } -#endif +#endif }; diff --git a/icu4c/source/i18n/decimfmt.cpp b/icu4c/source/i18n/decimfmt.cpp index eb9e1481c53..b7a56ff0fbe 100644 --- a/icu4c/source/i18n/decimfmt.cpp +++ b/icu4c/source/i18n/decimfmt.cpp @@ -835,10 +835,12 @@ DecimalFormat::operator=(const DecimalFormat& rhs) fPluralAffixesForCurrency = initHashForAffixPattern(status); copyHashForAffix(rhs.fPluralAffixesForCurrency, fPluralAffixesForCurrency, status); } - } #if UCONFIG_FORMAT_FASTPATHS_49 - handleChanged(); + DecimalFormatInternal &data = internalData(fReserved); + const DecimalFormatInternal &rhsData = internalData(rhs.fReserved); + data = rhsData; #endif + } return *this; } -- 2.40.0