Skip to content

Commit

Permalink
Fix maximum structure alignment on Android i386
Browse files Browse the repository at this point in the history
  • Loading branch information
BugsBeGone authored Mar 30, 2019
1 parent 163a586 commit 43fd6a4
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/com/sun/jna/Native.java
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,16 @@ static boolean isCompatibleVersion(String expectedVersion, String nativeVersion)
if (Boolean.getBoolean("jna.protected")) {
setProtected(true);
}
MAX_ALIGNMENT = Platform.isSPARC() || Platform.isWindows()
|| (Platform.isLinux() && (Platform.isARM() || Platform.isPPC() || Platform.isMIPS()))
|| Platform.isAIX()
|| Platform.isAndroid()
? 8 : LONG_SIZE;
// Check for GNUC i386. If not Windows, it must be GNUC.
if (!Platform.isWindows() && Platform.isIntel() && !Platform.is64Bit()) {
MAX_ALIGNMENT = 4;
} else {
MAX_ALIGNMENT = Platform.isSPARC() || Platform.isWindows()
|| (Platform.isLinux() && (Platform.isARM() || Platform.isPPC() || Platform.isMIPS()))
|| Platform.isAIX()
|| Platform.isAndroid()
? 8 : LONG_SIZE;
}
MAX_PADDING = (Platform.isMac() && Platform.isPPC()) ? 8 : MAX_ALIGNMENT;
System.setProperty("jna.loaded", "true");
}
Expand Down

0 comments on commit 43fd6a4

Please sign in to comment.