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 › copyFixedLength
copyFixedLength
memcpy.copyFixedLength
inline fn copyFixedLength (
noalias dest : [*]u8 ,
noalias src : [*]const u8 ,
comptime len : comptime_int ,
) void
File
Code
inline fn copyFixedLength (
noalias dest : [*]u8 ,
noalias src : [*]const u8 ,
comptime len : comptime_int ,
) void {
@setRuntimeSafety (false );
comptime assert (std .math .isPowerOfTwo (len ));
const T = if (len >= @sizeOf (Element ))
Element
else if (len > @sizeOf (usize ))
@Vector (len , u8 )
else
@Int (.unsigned , len * 8 );
const loop_count = @divExact (len , @sizeOf (T ));
const d : [*]align (1 ) T = @ptrCast (dest );
const s : [*]align (1 ) const T = @ptrCast (src );
inline for (0 ..loop_count ) |i | {
d [i ] = s [i ];
}
}