Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
ShirasawaSama committed Dec 14, 2023
1 parent 13abe05 commit e8a0915
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/main/java/cn/apisium/shm/CABI.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@

import org.jetbrains.annotations.NotNull;

import static java.lang.foreign.ValueLayout.ADDRESS;

public final class CABI {
/**
* System types.
*/
public enum SystemType { Unknown, Windows, Unix }
public enum SystemType { @SuppressWarnings("unused") Unknown, Windows, Unix }

/**
* The current system type.
Expand All @@ -18,12 +16,7 @@ public enum SystemType { Unknown, Windows, Unix }

static {
var OS = System.getProperty("os.name");
var ARCH = System.getProperty("os.arch");
var ADDRESS_SIZE = ADDRESS.byteSize();
if ((ARCH.equals("amd64") || ARCH.equals("x86_64")) && ADDRESS_SIZE == 64) {
SYSTEM_TYPE = OS.startsWith("Windows") ? SystemType.Windows : SystemType.Unknown;
} else if (ARCH.equals("aarch64")) {
SYSTEM_TYPE = SystemType.Unix;
} else SYSTEM_TYPE = SystemType.Unknown;
if (OS.startsWith("Windows")) SYSTEM_TYPE = SystemType.Windows;
else SYSTEM_TYPE = SystemType.Unix;
}
}

0 comments on commit e8a0915

Please sign in to comment.