aboutsummaryrefslogtreecommitdiff
path: root/src/deps/diffz/DiffMatchPatch.zig
diff options
context:
space:
mode:
authorGravatar Dylan Conway <35280289+dylan-conway@users.noreply.github.com> 2023-06-21 23:38:18 -0700
committerGravatar GitHub <noreply@github.com> 2023-06-21 23:38:18 -0700
commit5fa13625a1ca0ea1a3a1c5bb86d0880dcfac349f (patch)
tree97f669a178e60772038751d690c3e298a63557b2 /src/deps/diffz/DiffMatchPatch.zig
parentbfb322d618a3f0e9618d311ae69016fe7a08e771 (diff)
downloadbun-5fa13625a1ca0ea1a3a1c5bb86d0880dcfac349f.tar.gz
bun-5fa13625a1ca0ea1a3a1c5bb86d0880dcfac349f.tar.zst
bun-5fa13625a1ca0ea1a3a1c5bb86d0880dcfac349f.zip
upgrade zig to `v0.11.0-dev.3737+9eb008717` (#3374)
* progress * finish `@memset/@memcpy` update * Update build.zig * change `@enumToInt` to `@intFromEnum` and friends * update zig versions * it was 1 * add link to issue * add `compileError` reminder * fix merge * format * upgrade to llvm 16 * Revert "upgrade to llvm 16" This reverts commit cc930ceb1c5b4db9614a7638596948f704544ab8. --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com> Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/deps/diffz/DiffMatchPatch.zig')
-rw-r--r--src/deps/diffz/DiffMatchPatch.zig16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/deps/diffz/DiffMatchPatch.zig b/src/deps/diffz/DiffMatchPatch.zig
index 7e545f364..a5cc02af4 100644
--- a/src/deps/diffz/DiffMatchPatch.zig
+++ b/src/deps/diffz/DiffMatchPatch.zig
@@ -178,7 +178,7 @@ fn diffInternal(
}
fn diffCommonPrefix(before: []const u8, after: []const u8) usize {
- const n = std.math.min(before.len, after.len);
+ const n = @min(before.len, after.len);
var i: usize = 0;
while (i < n) : (i += 1) {
@@ -191,7 +191,7 @@ fn diffCommonPrefix(before: []const u8, after: []const u8) usize {
}
fn diffCommonSuffix(before: []const u8, after: []const u8) usize {
- const n = std.math.min(before.len, after.len);
+ const n = @min(before.len, after.len);
var i: usize = 1;
while (i <= n) : (i += 1) {
@@ -996,8 +996,8 @@ fn diffCleanupSemantic(allocator: std.mem.Allocator, diffs: *DiffList) DiffError
// Eliminate an equality that is smaller or equal to the edits on both
// sides of it.
if (last_equality != null and
- (last_equality.?.len <= std.math.max(length_insertions1, length_deletions1)) and
- (last_equality.?.len <= std.math.max(length_insertions2, length_deletions2)))
+ (last_equality.?.len <= @max(length_insertions1, length_deletions1)) and
+ (last_equality.?.len <= @max(length_insertions2, length_deletions2)))
{
// Duplicate record.
try diffs.insert(
@@ -1046,8 +1046,8 @@ fn diffCleanupSemantic(allocator: std.mem.Allocator, diffs: *DiffList) DiffError
var overlap_length1: usize = diffCommonOverlap(deletion, insertion);
var overlap_length2: usize = diffCommonOverlap(insertion, deletion);
if (overlap_length1 >= overlap_length2) {
- if (@intToFloat(f32, overlap_length1) >= @intToFloat(f32, deletion.len) / 2.0 or
- @intToFloat(f32, overlap_length1) >= @intToFloat(f32, insertion.len) / 2.0)
+ if (@floatFromInt(f32, overlap_length1) >= @floatFromInt(f32, deletion.len) / 2.0 or
+ @floatFromInt(f32, overlap_length1) >= @floatFromInt(f32, insertion.len) / 2.0)
{
// Overlap found.
// Insert an equality and trim the surrounding edits.
@@ -1063,8 +1063,8 @@ fn diffCleanupSemantic(allocator: std.mem.Allocator, diffs: *DiffList) DiffError
pointer += 1;
}
} else {
- if (@intToFloat(f32, overlap_length2) >= @intToFloat(f32, deletion.len) / 2.0 or
- @intToFloat(f32, overlap_length2) >= @intToFloat(f32, insertion.len) / 2.0)
+ if (@floatFromInt(f32, overlap_length2) >= @floatFromInt(f32, deletion.len) / 2.0 or
+ @floatFromInt(f32, overlap_length2) >= @floatFromInt(f32, insertion.len) / 2.0)
{
// Reverse overlap found.
// Insert an equality and swap and trim the surrounding edits.