mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-23 07:57:52 +00:00
Fix mem.set for LLVM C API
This commit is contained in:
+16
-6
@@ -13,16 +13,26 @@ swap :: proc{swap16, swap32, swap64};
|
||||
|
||||
set :: proc "contextless" (data: rawptr, value: byte, len: int) -> rawptr {
|
||||
foreign _ {
|
||||
when size_of(rawptr) == 8 {
|
||||
@(link_name="llvm.memset.p0i8.i64")
|
||||
llvm_memset :: proc(dst: rawptr, val: byte, len: int, is_volatile: bool) ---;
|
||||
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) ---;
|
||||
} else {
|
||||
@(link_name="llvm.memset.p0i8.i32")
|
||||
memset :: proc(dst: rawptr, val: byte, len: int, is_volatile: bool = false) ---;
|
||||
}
|
||||
} else {
|
||||
@(link_name="llvm.memset.p0i8.i32")
|
||||
llvm_memset :: proc(dst: rawptr, val: byte, len: int, is_volatile: bool) ---;
|
||||
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) ---;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
llvm_memset(data, value, len, false);
|
||||
memset(data, value, len);
|
||||
return data;
|
||||
}
|
||||
zero :: inline proc "contextless" (data: rawptr, len: int) -> rawptr {
|
||||
|
||||
Reference in New Issue
Block a user