aboutsummaryrefslogtreecommitdiff
path: root/src/arch/x86_64/Encoding.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-04-29 00:19:55 -0700
committerGitHub <noreply@github.com>2023-04-29 00:19:55 -0700
commitd65b42e07caa00dfe2f2fbf221c593ce57882784 (patch)
tree7926cbea1499e0affe930bf6d7455dc24adf014e /src/arch/x86_64/Encoding.zig
parentfd6200eda6d4fe19c34a59430a88a9ce38d6d7a4 (diff)
parentfa200ca0cad2705bad40eb723dedf4e3bf11f2ff (diff)
downloadzig-d65b42e07caa00dfe2f2fbf221c593ce57882784.tar.gz
zig-d65b42e07caa00dfe2f2fbf221c593ce57882784.zip
Merge pull request #15481 from ziglang/use-mem-intrinsics
actually use the new memory intrinsics
Diffstat (limited to 'src/arch/x86_64/Encoding.zig')
-rw-r--r--src/arch/x86_64/Encoding.zig8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/arch/x86_64/Encoding.zig b/src/arch/x86_64/Encoding.zig
index 21899b912b..a977af7842 100644
--- a/src/arch/x86_64/Encoding.zig
+++ b/src/arch/x86_64/Encoding.zig
@@ -546,7 +546,7 @@ fn estimateInstructionLength(prefix: Prefix, encoding: Encoding, ops: []const Op
.encoding = encoding,
.ops = [1]Operand{.none} ** 4,
};
- std.mem.copy(Operand, &inst.ops, ops);
+ @memcpy(inst.ops[0..ops.len], ops);
var cwriter = std.io.countingWriter(std.io.null_writer);
inst.encode(cwriter.writer(), .{ .allow_frame_loc = true }) catch unreachable; // Not allowed to fail here unless OOM.
@@ -575,8 +575,10 @@ const mnemonic_to_encodings_map = init: {
.modrm_ext = entry[4],
.mode = entry[5],
};
- std.mem.copy(Op, &data.ops, entry[2]);
- std.mem.copy(u8, &data.opc, entry[3]);
+ // TODO: use `@memcpy` for these. When I did that, I got a false positive
+ // compile error for this copy happening at compile time.
+ std.mem.copyForwards(Op, &data.ops, entry[2]);
+ std.mem.copyForwards(u8, &data.opc, entry[3]);
while (mnemonic_int < @enumToInt(entry[0])) : (mnemonic_int += 1) {
mnemonic_map[mnemonic_int] = data_storage[mnemonic_start..data_index];