Skip to content

Commit 5705c30

Browse files
committed
Cast unsigned integer directly to UIntMax
Crash would occur with `0xFFFFFFFFFFFFFFFF` otherwise
1 parent 95c1f9c commit 5705c30

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/LLVM/IntType.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public struct IntType: IRType {
4242
/// type's bit width. Defaults to `false`.
4343
public func constant<IntTy: UnsignedInteger>(_ value: IntTy, signExtend: Bool = false) -> Constant<Unsigned> {
4444
return Constant(llvm: LLVMConstInt(asLLVM(),
45-
UInt64(bitPattern: value.toIntMax()),
45+
value.toUIntMax(),
4646
signExtend.llvm))
4747
}
4848

0 commit comments

Comments
 (0)