aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/c.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-04-26 13:57:08 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-04-28 13:24:43 -0700
commit6261c1373168b265047db5704d9d0fd5f2e458f2 (patch)
tree18d6f31107b2c42ac9c6567b42f577bca41d769b /src/codegen/c.zig
parent57ea6207d3cb2db706bdc06c14605e4b901736dd (diff)
downloadzig-6261c1373168b265047db5704d9d0fd5f2e458f2.tar.gz
zig-6261c1373168b265047db5704d9d0fd5f2e458f2.zip
update codebase to use `@memset` and `@memcpy`
Diffstat (limited to 'src/codegen/c.zig')
-rw-r--r--src/codegen/c.zig14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig
index 9556419988..27b04cee8e 100644
--- a/src/codegen/c.zig
+++ b/src/codegen/c.zig
@@ -2411,9 +2411,9 @@ pub fn genErrDecls(o: *Object) !void {
const name_buf = try o.dg.gpa.alloc(u8, name_prefix.len + max_name_len);
defer o.dg.gpa.free(name_buf);
- mem.copy(u8, name_buf, name_prefix);
+ @memcpy(name_buf[0..name_prefix.len], name_prefix);
for (o.dg.module.error_name_list.items) |name| {
- mem.copy(u8, name_buf[name_prefix.len..], name);
+ @memcpy(name_buf[name_prefix.len..][0..name.len], name);
const identifier = name_buf[0 .. name_prefix.len + name.len];
var name_ty_pl = Type.Payload.Len{ .base = .{ .tag = .array_u8_sentinel_0 }, .data = name.len };
@@ -4877,7 +4877,7 @@ fn airAsm(f: *Function, inst: Air.Inst.Index) !CValue {
const literal = mem.sliceTo(asm_source[src_i..], '%');
src_i += literal.len;
- mem.copy(u8, fixed_asm_source[dst_i..], literal);
+ @memcpy(fixed_asm_source[dst_i..][0..literal.len], literal);
dst_i += literal.len;
if (src_i >= asm_source.len) break;
@@ -4902,9 +4902,9 @@ fn airAsm(f: *Function, inst: Air.Inst.Index) !CValue {
const name = desc[0..colon];
const modifier = desc[colon + 1 ..];
- mem.copy(u8, fixed_asm_source[dst_i..], modifier);
+ @memcpy(fixed_asm_source[dst_i..][0..modifier.len], modifier);
dst_i += modifier.len;
- mem.copy(u8, fixed_asm_source[dst_i..], name);
+ @memcpy(fixed_asm_source[dst_i..][0..name.len], name);
dst_i += name.len;
src_i += desc.len;
@@ -7455,7 +7455,7 @@ fn formatIntLiteral(
var int_buf: Value.BigIntSpace = undefined;
const int = if (data.val.isUndefDeep()) blk: {
undef_limbs = try allocator.alloc(BigIntLimb, BigInt.calcTwosCompLimbCount(data.int_info.bits));
- mem.set(BigIntLimb, undef_limbs, undefPattern(BigIntLimb));
+ @memset(undef_limbs, undefPattern(BigIntLimb));
var undef_int = BigInt.Mutable{
.limbs = undef_limbs,
@@ -7550,7 +7550,7 @@ fn formatIntLiteral(
} else {
try data.cty.renderLiteralPrefix(writer, data.kind);
wrap.convertToTwosComplement(int, data.int_info.signedness, c_bits);
- mem.set(BigIntLimb, wrap.limbs[wrap.len..], 0);
+ @memset(wrap.limbs[wrap.len..], 0);
wrap.len = wrap.limbs.len;
const limbs_per_c_limb = @divExact(wrap.len, c_limb_info.count);