mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-03-08 04:24:33 +01:00
compiler_rt memcpy: avoid infinite recursion
when compiled in debug mode (--debug-rt)
This commit is contained in:
parent
1d8857bbe3
commit
8d914ea734
1 changed files with 5 additions and 4 deletions
|
|
@ -175,10 +175,11 @@ inline fn copyRange4(
|
|||
const last = len - copy_len;
|
||||
const pen = last - b;
|
||||
|
||||
dest[0..copy_len].* = src[0..copy_len].*;
|
||||
dest[b..][0..copy_len].* = src[b..][0..copy_len].*;
|
||||
dest[pen..][0..copy_len].* = src[pen..][0..copy_len].*;
|
||||
dest[last..][0..copy_len].* = src[last..][0..copy_len].*;
|
||||
const Int = @Type(.{ .int = .{ .signedness = .unsigned, .bits = copy_len * 8 } });
|
||||
@as(*align(1) Int, @ptrCast(dest[0..copy_len])).* = @as(*align(1) const Int, @ptrCast(src[0..copy_len])).*;
|
||||
@as(*align(1) Int, @ptrCast(dest[b..][0..copy_len])).* = @as(*align(1) const Int, @ptrCast(src[b..][0..copy_len])).*;
|
||||
@as(*align(1) Int, @ptrCast(dest[pen..][0..copy_len])).* = @as(*align(1) const Int, @ptrCast(src[pen..][0..copy_len])).*;
|
||||
@as(*align(1) Int, @ptrCast(dest[last..][0..copy_len])).* = @as(*align(1) const Int, @ptrCast(src[last..][0..copy_len])).*;
|
||||
}
|
||||
|
||||
test "memcpy" {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue