Skip to content

Commit e01f349

Browse files
committed
fix: 32bit arch detection
1 parent 2c74ceb commit e01f349

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

managed/Plugify/Marshalling.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ public static Delegate GetDelegateForFunctionPointer(nint funcAddress, Type? del
584584
}
585585

586586
private static readonly bool IsArm = RuntimeInformation.ProcessArchitecture == Architecture.Arm64 || RuntimeInformation.ProcessArchitecture == Architecture.Arm;
587-
private static readonly bool X86 = RuntimeInformation.ProcessArchitecture == Architecture.X64 || RuntimeInformation.ProcessArchitecture == Architecture.X86;
587+
private static readonly bool Is32Bit = IntPtr.Size == 4;
588588
private static readonly bool IsWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
589589

590590
private static unsafe Func<object[], object> ExternalInvoke(nint funcAddress, MethodInfo methodInfo)
@@ -597,7 +597,7 @@ private static unsafe Func<object[], object> ExternalInvoke(nint funcAddress, Me
597597

598598
if (!hasRet)
599599
{
600-
ValueType firstHidden = (IsWindows && !IsArm) || X86 ? ValueType.Vector3 : ValueType.Matrix4x4;
600+
ValueType firstHidden = (IsWindows && !IsArm) || Is32Bit ? ValueType.Vector3 : ValueType.Matrix4x4;
601601
hasRet = returnType.ValueType >= firstHidden && returnType.ValueType <= ValueType.Matrix4x4;
602602
}
603603

0 commit comments

Comments
 (0)