From 3ae4df4fa8e7c0123051a14617eaa459e41db6a0 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Wed, 17 Jul 2024 22:25:09 -0400 Subject: [PATCH] Try to fix Native AOT --- .../tools/Common/TypeSystem/IL/Stubs/InterlockedIntrinsics.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/InterlockedIntrinsics.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/InterlockedIntrinsics.cs index 20e33b642fc15f..70092316218fcd 100644 --- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/InterlockedIntrinsics.cs +++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/InterlockedIntrinsics.cs @@ -38,7 +38,7 @@ public static MethodIL EmitIL( { ceArgType = method.Context.GetWellKnownType(WellKnownType.Object); } - else if ((tType.IsPrimitive || tType.IsEnum) && (tType.UnderlyingType.Category is not (TypeFlags.Single or TypeFlags.Double))) + else if (tType.IsPrimitive || tType.IsEnum) { int size = tType.GetElementSize().AsInt; Debug.Assert(size is 1 or 2 or 4 or 8); @@ -46,7 +46,9 @@ public static MethodIL EmitIL( { 1 => method.Context.GetWellKnownType(WellKnownType.Byte), 2 => method.Context.GetWellKnownType(WellKnownType.UInt16), + 4 when tType.UnderlyingType.Category is TypeFlags.Single => method.Context.GetWellKnownType(WellKnownType.Single), 4 => method.Context.GetWellKnownType(WellKnownType.Int32), + _ when tType.UnderlyingType.Category is TypeFlags.Double => method.Context.GetWellKnownType(WellKnownType.Double), _ => method.Context.GetWellKnownType(WellKnownType.Int64), }; }