mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-15 01:42:37 +00:00
ICU-12462 Slightly improve the power function performance.
X-SVN-Rev: 39161
This commit is contained in:
parent
4bd854a73c
commit
08c37f83f0
1 changed files with 3 additions and 4 deletions
|
@ -838,13 +838,12 @@ final class NFRule {
|
|||
throw new IllegalArgumentException("Base can not be negative");
|
||||
}
|
||||
long result = 1;
|
||||
long pow = base;
|
||||
while (exponent > 0) {
|
||||
if ((exponent & 1) == 1) {
|
||||
result *= pow;
|
||||
result *= base;
|
||||
}
|
||||
pow *= pow;
|
||||
exponent = (short) (exponent >> 1);
|
||||
base *= base;
|
||||
exponent >>= 1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue