Zig 0.17.0-dev (Split by item)
This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig library itself.
Zig › compiler_rt/ › memcpy.zig › testMemcpyImpl
testMemcpyImpl
memcpy.testMemcpyImpl
fn testMemcpyImpl (comptime memcpyImpl : anytype ) !void
File
Code
fn testMemcpyImpl (comptime memcpyImpl : anytype ) !void {
const max_len = 1024 ;
var buffer : [max_len + @alignOf (Element ) - 1 ]u8 align (@alignOf (Element )) = undefined ;
for (&buffer , 0 ..) |*b , i | {
b .* = @intCast (i % 97 );
}
var dest : [max_len + @alignOf (Element ) - 1 ]u8 align (@alignOf (Element )) = undefined ;
for (0 ..max_len ) |copy_len | {
for (0 ..@alignOf (Element )) |s_offset | {
for (0 ..@alignOf (Element )) |d_offset | {
@memset (&dest , 0xff );
const s = buffer [s_offset ..][0 ..copy_len ];
const d = dest [d_offset ..][0 ..copy_len ];
_ = memcpyImpl (@ptrCast (d .ptr ), @ptrCast (s .ptr ), s .len );
std .testing .expectEqualSlices (u8 , s , d ) catch |e | {
std .debug .print ("error encountered for length={d}, s_offset={d}, d_offset={d}\n" , .{
copy_len , s_offset , d_offset ,
});
return e ;
};
}
}
}
}