Skip to content

Commit

Permalink
do not use if statment
Browse files Browse the repository at this point in the history
  • Loading branch information
younies committed Sep 22, 2023
1 parent 8804d47 commit eed52a9
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions icu4c/source/i18n/units_converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,20 +372,12 @@ void U_I18N_API addSingleFactorConstant(StringPiece baseStr, int32_t power, Sign
factor.constantExponents[CONSTANT_FT2M] += 3 * power * signum;
} else if (baseStr == "in3_to_m3") {
factor.constantExponents[CONSTANT_FT2M] += 3 * power * signum;
if (signum == Signum::NEGATIVE) {
factor.factorNum *= std::pow(12 * 12 * 12, power);
} else {
factor.factorDen *= std::pow(12 * 12 * 12, power);
}
factor.factorDen *= std::pow(12 * 12 * 12, power * signum);
} else if (baseStr == "gal_to_m3") {
factor.constantExponents[CONSTANT_FT2M] += 3 * power * signum;
if (signum == Signum::NEGATIVE) {
factor.factorDen *= std::pow(231, power);
factor.factorNum *= std::pow(12 * 12 * 12, power);
} else {
factor.factorNum *= std::pow(231, power);
factor.factorDen *= std::pow(12 * 12 * 12, power);
}
factor.factorNum *= std::pow(231, power * signum);
factor.factorDen *= std::pow(12 * 12 * 12, power * signum);

} else if (baseStr == "gal_imp_to_m3") {
factor.constantExponents[CONSTANT_GAL_IMP2M3] += power * signum;
} else if (baseStr == "G") {
Expand Down

0 comments on commit eed52a9

Please sign in to comment.