fix: do not remove libc memmove until performance comparisons have been conducted

pull/9033/head
NikoMalik 2025-10-05 17:35:58 +03:00
parent 1c0282d658
commit ff3a6d0650
1 changed files with 7 additions and 3 deletions

View File

@ -2,10 +2,14 @@ const std = @import("std");
const builtin = @import("builtin");
const assert = std.debug.assert;
/// Same as std.mem.copyForwards/Backwards but prefers libc memmove if it is
/// available because it is generally much faster.
/// Same as @memmove but prefers libc memmove if it is
/// available because it is generally much faster?.
pub inline fn move(comptime T: type, dest: []T, source: []const T) void {
@memmove(dest, source);
if (builtin.link_libc) {
_ = memmove(dest.ptr, source.ptr, source.len * @sizeOf(T));
} else {
@memmove(dest, source);
}
}
/// Same as @memcpy but prefers libc memcpy if it is available