Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

Commit 9760354

Browse files
author
buchholz
committed
indentation and comments
1 parent 70b1d43 commit 9760354

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/main/java/org/javamoney/moneta/FastMoney.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -456,14 +456,14 @@ private long multiplyExact(long num1, long num2) {
456456

457457
// Hacker's Delight,
458458
int leadingZeros =
459-
Long.numberOfLeadingZeros(num1) +
460-
Long.numberOfLeadingZeros(~num1) +
459+
Long.numberOfLeadingZeros(num1) +
460+
Long.numberOfLeadingZeros(~num1) +
461461
Long.numberOfLeadingZeros(num2) +
462462
Long.numberOfLeadingZeros(~num2);
463463

464-
if (leadingZeros > Long.SIZE + 1 ) {
465-
// in this case, an overflow is impossible
466-
return num1 * num2;
464+
if (leadingZeros > Long.SIZE + 1 ) {
465+
// in this case, an overflow is impossible
466+
return num1 * num2;
467467
}
468468

469469
if (leadingZeros < Long.SIZE){

src/test/java/org/javamoney/moneta/FastMoneyTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,10 +289,9 @@ public void testAdd(){
289289
FastMoney moneyResult = money1.add(money2);
290290
assertNotNull(moneyResult);
291291
assertEquals(11d, moneyResult.getNumber().doubleValue(), 0d);
292-
293-
// 87978089321359 + 4866358678300 = 92844447999659 > 92233720368547.75807
294292

295-
// This example produce a false positive in the old version
293+
// This example create a sum that is to big for fastmoney, it should overflow
294+
// 87978089321359 + 4866358678300 = 92844447999659 > 92233720368547.75807
296295
money1 = FastMoney.of(87978089321359L, EURO);
297296
money2 = FastMoney.of(4866358678300L, EURO);
298297

0 commit comments

Comments
 (0)