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:
@@ -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();
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user