From b1c644f0f8d0b4b313767e1810d9c00069730935 Mon Sep 17 00:00:00 2001 From: ds5678 <49847914+ds5678@users.noreply.github.com> Date: Thu, 12 Jun 2025 14:12:44 -0700 Subject: [PATCH 1/2] Allow ScalableVectorType to use VectorSize property --- sources/LLVMSharp.Interop/Extensions/LLVMTypeRef.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/LLVMSharp.Interop/Extensions/LLVMTypeRef.cs b/sources/LLVMSharp.Interop/Extensions/LLVMTypeRef.cs index 54b41a4..16de4cb 100644 --- a/sources/LLVMSharp.Interop/Extensions/LLVMTypeRef.cs +++ b/sources/LLVMSharp.Interop/Extensions/LLVMTypeRef.cs @@ -96,7 +96,7 @@ public readonly string StructName public readonly LLVMValueRef Undef => (Handle != IntPtr.Zero) ? LLVM.GetUndef(this) : default; - public readonly uint VectorSize => (Kind == LLVMTypeKind.LLVMVectorTypeKind) ? LLVM.GetVectorSize(this) : default; + public readonly uint VectorSize => (Kind is LLVMTypeKind.LLVMVectorTypeKind or LLVMTypeKind.LLVMScalableVectorTypeKind) ? LLVM.GetVectorSize(this) : default; public static implicit operator LLVMTypeRef(LLVMOpaqueType* value) => new LLVMTypeRef((IntPtr)value); From 0b3a5ec82e779a2a061515325d1c8879189d5249 Mon Sep 17 00:00:00 2001 From: ds5678 <49847914+ds5678@users.noreply.github.com> Date: Thu, 12 Jun 2025 14:52:15 -0700 Subject: [PATCH 2/2] ElementType too --- sources/LLVMSharp.Interop/Extensions/LLVMTypeRef.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/LLVMSharp.Interop/Extensions/LLVMTypeRef.cs b/sources/LLVMSharp.Interop/Extensions/LLVMTypeRef.cs index 16de4cb..5298d52 100644 --- a/sources/LLVMSharp.Interop/Extensions/LLVMTypeRef.cs +++ b/sources/LLVMSharp.Interop/Extensions/LLVMTypeRef.cs @@ -46,7 +46,7 @@ public unsafe partial struct LLVMTypeRef(IntPtr handle) : IEquatable (Handle != IntPtr.Zero) ? LLVM.GetTypeContext(this) : default; - public readonly LLVMTypeRef ElementType => (((Kind == LLVMTypeKind.LLVMPointerTypeKind) && (SubtypesCount != 0)) || (Kind == LLVMTypeKind.LLVMArrayTypeKind) || (Kind == LLVMTypeKind.LLVMVectorTypeKind)) ? LLVM.GetElementType(this) : default; + public readonly LLVMTypeRef ElementType => (((Kind == LLVMTypeKind.LLVMPointerTypeKind) && (SubtypesCount != 0)) || (Kind is LLVMTypeKind.LLVMArrayTypeKind or LLVMTypeKind.LLVMVectorTypeKind or LLVMTypeKind.LLVMScalableVectorTypeKind)) ? LLVM.GetElementType(this) : default; public readonly uint IntWidth => (Kind == LLVMTypeKind.LLVMIntegerTypeKind) ? LLVM.GetIntTypeWidth(this) : default;