Skip to content

Commit

Permalink
compiler-rt: remove len == 1 memcpy branch
Browse files Browse the repository at this point in the history
  • Loading branch information
dweiller committed Nov 21, 2024
1 parent a09acd2 commit 8688b0a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/compiler_rt/memcpy.zig
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ fn memcpy_fast(noalias dest: ?[*]u8, noalias src: ?[*]const u8, len: usize) call
if (len < 16) {
if (len < 4) {
if (len == 0) return dest;
const a = len & 2;
const b = a / 2;
dest.?[0] = src.?[0];
if (len == 1) return dest;
dest.?[1] = src.?[1];
dest.?[b] = src.?[b];
dest.?[len - 1] = src.?[len - 1];
return dest;
}
Expand Down

0 comments on commit 8688b0a

Please sign in to comment.