mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
switch memcpy to fallback on windows
This commit is contained in:
parent
f1126aae75
commit
a77ac8244e
2 changed files with 17 additions and 9 deletions
|
@ -24,14 +24,19 @@ pub var memcpy_target: Memcpy = switch (arch) {
|
|||
};
|
||||
|
||||
pub fn memcpy(noalias dest: [*]u8, noalias src: [*]const u8, len: usize) callconv(.C) [*]u8 {
|
||||
switch (arch) {
|
||||
// x86_64 has a special optimized memcpy that can use avx2.
|
||||
.x86_64 => {
|
||||
return memcpy_target(dest, src, len);
|
||||
},
|
||||
else => {
|
||||
switch (builtin.os.tag) {
|
||||
.windows => {
|
||||
return musl.memcpy(dest, src, len);
|
||||
},
|
||||
else => switch (arch) {
|
||||
// x86_64 has a special optimized memcpy that can use avx2.
|
||||
.x86_64 => {
|
||||
return memcpy_target(dest, src, len);
|
||||
},
|
||||
else => {
|
||||
return musl.memcpy(dest, src, len);
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,9 +17,12 @@ comptime {
|
|||
}
|
||||
|
||||
pub const memcpy =
|
||||
switch (arch) {
|
||||
.x86_64, .x86 => musl_memcpy,
|
||||
else => fallback_memcpy,
|
||||
switch (builtin.os.tag) {
|
||||
.windows => fallback_memcpy,
|
||||
else => switch (arch) {
|
||||
.x86_64, .x86 => musl_memcpy,
|
||||
else => fallback_memcpy,
|
||||
},
|
||||
};
|
||||
|
||||
pub extern fn musl_memcpy(noalias dest: [*]u8, noalias src: [*]const u8, len: usize) callconv(.C) [*]u8;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue