mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 16:18:52 +00:00
Fix llvm.memset for both backends
This commit is contained in:
@@ -40,6 +40,7 @@ mem_zero :: proc "contextless" (data: rawptr, len: int) -> rawptr {
|
||||
if len < 0 do return data;
|
||||
when !#defined(memset) {
|
||||
foreign _ {
|
||||
when ODIN_USE_LLVM_API {
|
||||
when size_of(rawptr) == 8 {
|
||||
@(link_name="llvm.memset.p0i8.i64")
|
||||
memset :: proc(dst: rawptr, val: byte, len: int, is_volatile: bool = false) ---;
|
||||
@@ -47,6 +48,15 @@ mem_zero :: proc "contextless" (data: rawptr, len: int) -> rawptr {
|
||||
@(link_name="llvm.memset.p0i8.i32")
|
||||
memset :: proc(dst: rawptr, val: byte, len: int, is_volatile: bool = false) ---;
|
||||
}
|
||||
} else {
|
||||
when size_of(rawptr) == 8 {
|
||||
@(link_name="llvm.memset.p0i8.i64")
|
||||
memset :: proc(dst: rawptr, val: byte, len: int, align: i32 = 1, is_volatile: bool = false) ---;
|
||||
} else {
|
||||
@(link_name="llvm.memset.p0i8.i32")
|
||||
memset :: proc(dst: rawptr, val: byte, len: int, align: i32 = 1, is_volatile: bool = false) ---;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
memset(data, 0, len);
|
||||
|
||||
Reference in New Issue
Block a user