From 1f4e754adb18906e37ca806f0cf28e400e51cd25 Mon Sep 17 00:00:00 2001 From: walon Date: Sat, 6 May 2023 18:57:47 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20=E4=BF=AE=E5=A4=8D=E5=BD=93struct?= =?UTF-8?q?=E5=8F=AA=E5=8C=85=E5=90=AB=E4=B8=80=E4=B8=AAfloat=E6=88=96doub?= =?UTF-8?q?le=E5=AD=97=E6=AE=B5=E6=97=B6=EF=BC=8C=E5=9C=A8arm64=E4=B8=8A?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E6=A1=A5=E6=8E=A5=E5=87=BD=E6=95=B0=E7=AD=BE?= =?UTF-8?q?=E5=90=8D=E9=94=99=E8=AF=AF=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Editor/ABI/TypeCreatorBase.cs | 7 ++++--- Editor/ABI/TypeCreatorUniversal64.cs | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Editor/ABI/TypeCreatorBase.cs b/Editor/ABI/TypeCreatorBase.cs index 36cfa41..24e081f 100644 --- a/Editor/ABI/TypeCreatorBase.cs +++ b/Editor/ABI/TypeCreatorBase.cs @@ -70,7 +70,7 @@ namespace HybridCLR.Editor.ABI case ElementType.Module: case ElementType.Var: case ElementType.MVar: - return GetNativeIntTypeInfo(); + return GetNativeIntTypeInfo(); case ElementType.TypedByRef: return CreateValueType(type); case ElementType.ValueType: { @@ -105,7 +105,7 @@ namespace HybridCLR.Editor.ABI private static bool IsNotHFAFastCheck(int typeSize) { - return typeSize != 8 && typeSize != 12 && typeSize != 16 && typeSize != 24 && typeSize != 32; + return typeSize % 4 != 0 || typeSize > 32; } private static bool ComputHFATypeInfo0(TypeSig type, HFATypeInfo typeInfo) @@ -169,7 +169,7 @@ namespace HybridCLR.Editor.ABI return false; } bool ok = ComputHFATypeInfo0(type, typeInfo); - if (ok && typeInfo.Count >= 2 && typeInfo.Count <= 4) + if (ok && typeInfo.Count >= 1 && typeInfo.Count <= 4) { int fieldSize = typeInfo.Type.ElementType == ElementType.R4 ? 4 : 8; return typeSize == fieldSize * typeInfo.Count; @@ -293,6 +293,7 @@ namespace HybridCLR.Editor.ABI bool isFloat = hfaTypeInfo.Type.ElementType == ElementType.R4; switch (hfaTypeInfo.Count) { + case 1: return isFloat ? TypeInfo.s_r4 : TypeInfo.s_r8; case 2: return isFloat ? TypeInfo.s_vf2 : TypeInfo.s_vd2; case 3: return isFloat ? TypeInfo.s_vf3 : TypeInfo.s_vd3; case 4: return isFloat ? TypeInfo.s_vf4 : TypeInfo.s_vd4; diff --git a/Editor/ABI/TypeCreatorUniversal64.cs b/Editor/ABI/TypeCreatorUniversal64.cs index c4808ae..ec6fd6b 100644 --- a/Editor/ABI/TypeCreatorUniversal64.cs +++ b/Editor/ABI/TypeCreatorUniversal64.cs @@ -10,7 +10,7 @@ namespace HybridCLR.Editor.ABI { public override bool IsArch32 => false; - public override bool IsSupportHFA => true; + public override bool IsSupportHFA => false; protected override TypeInfo OptimizeSigType(TypeInfo type, bool returnType) {