9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2026-01-04 15:41:40 +00:00

Cleanup get java version & SIMD util

- Use modern API which introduced since Java 10 to get java major version
- Remove useless fields in SIMD util, Java 21+ supports SIMD.
This commit is contained in:
Dreeam
2025-07-10 00:15:42 +08:00
parent b17348bdf9
commit ada68f0d1a
5 changed files with 13 additions and 61 deletions

View File

@@ -5,7 +5,7 @@ import joptsimple.OptionSet;
public class LeafBootstrap {
public static final boolean enableFMA = Boolean.getBoolean("Leaf.enableFMA");
public static final boolean enableFMA = Boolean.getBoolean("Leaf.enableFMA"); // Leaf - Optimize Entity distanceTo
public static void boot(final OptionSet options) {
//runPreBootTasks();

View File

@@ -88,17 +88,4 @@ public sealed abstract class VirtualThreadService permits ReflectionVirtualThrea
* even without any feature preview flags.
*/
public static final int minimumJavaMajorVersionWithoutFeaturePreview = 21;
public static int getJavaMajorVersion() {
var version = System.getProperty("java.version");
if (version.startsWith("1.")) {
return version.charAt(2) - '0';
}
if (version.contains("-")) {
version = version.substring(0, version.indexOf("-"));
}
int dotIndex = version.indexOf(".");
return Integer.parseInt(dotIndex == -1 ? version : version.substring(0, dotIndex));
}
}