Skip to content

Commit

Permalink
parser: memcpy only the required elements
Browse files Browse the repository at this point in the history
  • Loading branch information
Cloudef committed Feb 26, 2024
1 parent 7ef76ae commit ee299b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/budoux.zig
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ pub const ChunkIterator = struct {
score += 2 * self.model.get(.TW4, self.unicodeSlice(byte_index, 0, 3));

self.unicode_index += 1;
const cpy = self.history;
@memcpy(self.history[1..self.history.len], cpy[0 .. self.history.len - 1]);
const cpy: [2]usize = self.history[0..2].*;
@memcpy(self.history[1..3], cpy[0..2]);
self.history[0] = self.iterator.i;

debug("{s}, {d}", .{ self.iterator.bytes[chunk_offset..self.iterator.i], score });
Expand Down

0 comments on commit ee299b5

Please sign in to comment.