Skip to content

Commit 2844ae0

Browse files
committed
remove usage of array multiplication
1 parent b39fe07 commit 2844ae0

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

DiffMatchPatch.zig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2491,8 +2491,10 @@ test diff {
24912491

24922492
// Increase the text lengths by 1024 times to ensure a timeout.
24932493
{
2494-
const a = "`Twas brillig, and the slithy toves\nDid gyre and gimble in the wabe:\nAll mimsy were the borogoves,\nAnd the mome raths outgrabe.\n" ** 1024;
2495-
const b = "I am the very model of a modern major general,\nI've information vegetable, animal, and mineral,\nI know the kings of England, and I quote the fights historical,\nFrom Marathon to Waterloo, in order categorical.\n" ** 1024;
2494+
const a_text: *const [128]u8 = "`Twas brillig, and the slithy toves\nDid gyre and gimble in the wabe:\nAll mimsy were the borogoves,\nAnd the mome raths outgrabe.\n";
2495+
const b_text: *const [209]u8 = "I am the very model of a modern major general,\nI've information vegetable, animal, and mineral,\nI know the kings of England, and I quote the fights historical,\nFrom Marathon to Waterloo, in order categorical.\n";
2496+
const a: []const u8 = @ptrCast(&@as([1024][a_text.len]u8, @splat(a_text.*)));
2497+
const b: []const u8 = @ptrCast(&@as([1024][b_text.len]u8, @splat(b_text.*)));
24962498

24972499
const timeout: std.Io.Timeout = .{ .duration = .{ .clock = .awake, .raw = .fromMilliseconds(100) } };
24982500

0 commit comments

Comments
 (0)