Skip to content

Commit 4ce5ab2

Browse files
Merge pull request #235 from ds5678/fix-type-vectorsize
Allow ScalableVectorType to use VectorSize and ElementType properties
2 parents faedb6d + 1019226 commit 4ce5ab2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sources/LLVMSharp.Interop/Extensions/LLVMTypeRef.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public unsafe partial struct LLVMTypeRef(IntPtr handle) : IEquatable<LLVMTypeRef
4848

4949
public readonly LLVMContextRef Context => (Handle != IntPtr.Zero) ? LLVM.GetTypeContext(this) : default;
5050

51-
public readonly LLVMTypeRef ElementType => (((Kind == LLVMTypeKind.LLVMPointerTypeKind) && (SubtypesCount != 0)) || (Kind == LLVMTypeKind.LLVMArrayTypeKind) || (Kind == LLVMTypeKind.LLVMVectorTypeKind)) ? LLVM.GetElementType(this) : default;
51+
public readonly LLVMTypeRef ElementType => (((Kind == LLVMTypeKind.LLVMPointerTypeKind) && (SubtypesCount != 0)) || (Kind is LLVMTypeKind.LLVMArrayTypeKind or LLVMTypeKind.LLVMVectorTypeKind or LLVMTypeKind.LLVMScalableVectorTypeKind)) ? LLVM.GetElementType(this) : default;
5252

5353
public readonly uint IntWidth => (Kind == LLVMTypeKind.LLVMIntegerTypeKind) ? LLVM.GetIntTypeWidth(this) : default;
5454

@@ -101,7 +101,7 @@ public readonly string StructName
101101
[DebuggerBrowsable(DebuggerBrowsableState.Never)] // Justification: causes native allocation
102102
public readonly LLVMValueRef Undef => (Handle != IntPtr.Zero) ? LLVM.GetUndef(this) : default;
103103

104-
public readonly uint VectorSize => (Kind == LLVMTypeKind.LLVMVectorTypeKind) ? LLVM.GetVectorSize(this) : default;
104+
public readonly uint VectorSize => (Kind is LLVMTypeKind.LLVMVectorTypeKind or LLVMTypeKind.LLVMScalableVectorTypeKind) ? LLVM.GetVectorSize(this) : default;
105105

106106
public static implicit operator LLVMTypeRef(LLVMOpaqueType* value) => new LLVMTypeRef((IntPtr)value);
107107

0 commit comments

Comments
 (0)