Skip to content

Commit 3cc7d93

Browse files
committed
Update to Java 22
1 parent b1b055f commit 3cc7d93

File tree

5 files changed

+9
-13
lines changed

5 files changed

+9
-13
lines changed

.github/workflows/main.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
java: ['17']
10+
java: ['22']
1111
steps:
1212
- uses: actions/checkout@v1
1313
- name: Setup test JDK ${{ matrix.java }}
1414
uses: actions/setup-java@v1
1515
with:
1616
java-version: ${{ matrix.java }}
1717
- run: echo "test_java_home=$JAVA_HOME" >> $GITHUB_ENV
18-
- name: Setup build JDK 17
18+
- name: Setup build JDK 22
1919
uses: actions/setup-java@v1
2020
with:
21-
java-version: 17
21+
java-version: 22
2222
- name: Maven Test
2323
run: mvn install -V -B -Dtest_java_home=${{ env.test_java_home }}
2424

pom.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@
9797
<artifactId>maven-compiler-plugin</artifactId>
9898
<version>3.8.1</version>
9999
<configuration>
100-
<release>17</release>
100+
<source>22</source>
101+
<release>22</release>
101102
</configuration>
102103
</plugin>
103104
</plugins>

src/main/java/org/weakref/int128/Int128.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
import java.nio.ByteOrder;
2020
import java.util.concurrent.ThreadLocalRandom;
2121

22+
import static java.lang.Math.unsignedMultiplyHigh;
2223
import static org.weakref.int128.MoreMath.ifNegative;
2324
import static org.weakref.int128.MoreMath.unsignedBorrow;
2425
import static org.weakref.int128.MoreMath.unsignedCarry;
25-
import static org.weakref.int128.MoreMath.unsignedMultiplyHigh;
2626

2727
public record Int128(long high, long low)
2828
implements Comparable<Int128>

src/main/java/org/weakref/int128/Int128Math.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
*/
1414
package org.weakref.int128;
1515

16+
import static java.lang.Math.unsignedMultiplyHigh;
17+
1618
public final class Int128Math
1719
{
1820
private Int128Math() {}
@@ -138,7 +140,7 @@ public static long subtractLowExact(long aHigh, long aLow, long bHigh, long bLow
138140

139141
public static long multiplyHigh(long aHigh, long aLow, long bHigh, long bLow)
140142
{
141-
return MoreMath.unsignedMultiplyHigh(aLow, bLow) + aLow * bHigh + aHigh * bLow;
143+
return unsignedMultiplyHigh(aLow, bLow) + aLow * bHigh + aHigh * bLow;
142144
}
143145

144146
public static long multiplyLow(long aHigh, long aLow, long bHigh, long bLow)

src/main/java/org/weakref/int128/MoreMath.java

-7
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,4 @@ public static long ifNegative(long test, long value)
5353
{
5454
return value & (test >> 63);
5555
}
56-
57-
// TODO: replace with JDK 18's Math.unsignedMultiplyHigh
58-
public static long unsignedMultiplyHigh(long x, long y)
59-
{
60-
// HD 8-3: High-Order Product Signed from/to Unsigned
61-
return Math.multiplyHigh(x, y) + ifNegative(x, y) + ifNegative(y, x);
62-
}
6356
}

0 commit comments

Comments
 (0)