aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vaughan Rouesnel <vrouesnel@gmail.com> 2022-11-12 00:04:44 +0100
committerGravatar Vaughan Rouesnel <vrouesnel@gmail.com> 2022-11-12 00:04:44 +0100
commit101997fbb08ffdd294edc024fb17739f717da156 (patch)
treeeb824445ed28670701953a33ceba6b3579976e97
parent521cbfc8e17a726b57851dc7fc46a3841ab26071 (diff)
downloadbun-101997fbb08ffdd294edc024fb17739f717da156.tar.gz
bun-101997fbb08ffdd294edc024fb17739f717da156.tar.zst
bun-101997fbb08ffdd294edc024fb17739f717da156.zip
Fix: invalid builtin function: '@maximum'
-rw-r--r--misctools/http_bench.zig2
-rw-r--r--src/bun.js/api/bun.zig4
-rw-r--r--src/bun.js/api/bun/subprocess.zig2
-rw-r--r--src/bun.js/api/html_rewriter.zig12
-rw-r--r--src/bun.js/api/server.zig8
-rw-r--r--src/bun.js/base.zig4
-rw-r--r--src/bun.js/bindings/bindings.zig4
-rw-r--r--src/bun.js/javascript.zig16
-rw-r--r--src/bun.js/node/node_fs.zig6
-rw-r--r--src/bun.js/node/syscall.zig2
-rw-r--r--src/bun.js/node/types.zig12
-rw-r--r--src/bun.js/webcore/response.zig16
-rw-r--r--src/bun.js/webcore/streams.zig16
-rw-r--r--src/cli.zig2
-rw-r--r--src/cli/add_completions.zig2
-rw-r--r--src/cli/upgrade_command.zig6
-rw-r--r--src/css_scanner.zig2
-rw-r--r--src/fs.zig2
-rw-r--r--src/http.zig2
-rw-r--r--src/http/url_path.zig6
-rw-r--r--src/http_client_async.zig2
-rw-r--r--src/install/install.zig10
-rw-r--r--src/install/integrity.zig2
-rw-r--r--src/install/npm.zig16
-rw-r--r--src/install/resolvers/folder_resolver.zig2
-rw-r--r--src/js_ast.zig10
-rw-r--r--src/js_printer.zig10
-rw-r--r--src/libarchive/libarchive.zig2
-rw-r--r--src/logger.zig4
-rw-r--r--src/mdx/mdx_parser.zig2
-rw-r--r--src/network_thread.zig14
-rw-r--r--src/report.zig6
-rw-r--r--src/router.zig6
-rw-r--r--src/sourcemap/sourcemap.zig6
-rw-r--r--src/string_immutable.zig4
-rw-r--r--src/string_types.zig2
-rw-r--r--src/url.zig2
-rw-r--r--src/watcher.zig2
-rw-r--r--src/work_pool.zig2
39 files changed, 115 insertions, 115 deletions
diff --git a/misctools/http_bench.zig b/misctools/http_bench.zig
index fe2d29d6a..acf3aac31 100644
--- a/misctools/http_bench.zig
+++ b/misctools/http_bench.zig
@@ -252,7 +252,7 @@ pub fn main() anyerror!void {
fail_count += 1;
}
- max_duration = @maximum(max_duration, http.elapsed);
+ max_duration = @max(max_duration, http.elapsed);
min_duration = @min(min_duration, http.elapsed);
switch (resp.status_code) {
diff --git a/src/bun.js/api/bun.zig b/src/bun.js/api/bun.zig
index 2fa6839d6..58407e2c0 100644
--- a/src/bun.js/api/bun.zig
+++ b/src/bun.js/api/bun.zig
@@ -1706,7 +1706,7 @@ pub fn allocUnsafe(
const length = @intCast(
usize,
@min(
- @maximum(1, (args.nextEat() orelse JSC.JSValue.jsNumber(@as(i32, 1))).toInt32()),
+ @max(1, (args.nextEat() orelse JSC.JSValue.jsNumber(@as(i32, 1))).toInt32()),
std.math.maxInt(i32),
),
);
@@ -2434,7 +2434,7 @@ pub const Timer = struct {
// We don't deal with nesting levels directly
// but we do set the minimum timeout to be 1ms for repeating timers
- const interval: i32 = @maximum(
+ const interval: i32 = @max(
countdown.coerce(i32, globalThis),
if (repeat) @as(i32, 1) else 0,
);
diff --git a/src/bun.js/api/bun/subprocess.zig b/src/bun.js/api/bun/subprocess.zig
index 4f6a91034..1dbc045d3 100644
--- a/src/bun.js/api/bun/subprocess.zig
+++ b/src/bun.js/api/bun/subprocess.zig
@@ -505,7 +505,7 @@ pub const Subprocess = struct {
pub fn readAll(this: *BufferedOutput, comptime force: bool) void {
// read as much as we can from the pipe
while (this.internal_buffer.len <= this.max_internal_buffer) {
- var buffer_: [@maximum(std.mem.page_size, 16384)]u8 = undefined;
+ var buffer_: [@max(std.mem.page_size, 16384)]u8 = undefined;
var buf: []u8 = buffer_[0..];
diff --git a/src/bun.js/api/html_rewriter.zig b/src/bun.js/api/html_rewriter.zig
index eb602223b..a3632bf32 100644
--- a/src/bun.js/api/html_rewriter.zig
+++ b/src/bun.js/api/html_rewriter.zig
@@ -308,7 +308,7 @@ pub const HTMLRewriter = struct {
doc.ctx = this;
}
- const chunk_size = @maximum(size_hint orelse 16384, 1024);
+ const chunk_size = @max(size_hint orelse 16384, 1024);
this.rewriter = builder.build(
.UTF8,
.{
@@ -418,7 +418,7 @@ pub const HTMLRewriter = struct {
.preallocated_parsing_buffer_size = if (input_size == JSC.WebCore.Blob.max_size)
1024
else
- @maximum(input_size, 1024),
+ @max(input_size, 1024),
.max_allowed_memory_usage = std.math.maxInt(u32),
},
false,
@@ -594,7 +594,7 @@ pub const HTMLRewriter = struct {
// sink.rewriter = builder.build(
// .UTF8,
// .{
- // .preallocated_parsing_buffer_size = @maximum(original.body.len(), 1024),
+ // .preallocated_parsing_buffer_size = @max(original.body.len(), 1024),
// .max_allowed_memory_usage = std.math.maxInt(u32),
// },
// false,
@@ -1467,13 +1467,13 @@ pub const AttributeIterator = struct {
\\ }
\\
\\ #iterator;
- \\
+ \\
\\ [Symbol.iterator]() {
\\ return this;
\\ }
- \\
+ \\
\\ next() {
- \\ if (this.#iterator === null)
+ \\ if (this.#iterator === null)
\\ return {done: true};
\\ var value = this.#iterator.next();
\\ if (!value) {
diff --git a/src/bun.js/api/server.zig b/src/bun.js/api/server.zig
index 4d1d13693..6639195f1 100644
--- a/src/bun.js/api/server.zig
+++ b/src/bun.js/api/server.zig
@@ -305,7 +305,7 @@ pub const ServerConfig = struct {
args.port = @intCast(
u16,
@min(
- @maximum(0, port_.coerce(i32, global)),
+ @max(0, port_.coerce(i32, global)),
std.math.maxInt(u16),
),
);
@@ -358,7 +358,7 @@ pub const ServerConfig = struct {
}
if (arg.getTruthy(global, "maxRequestBodySize")) |max_request_body_size| {
- args.max_request_body_size = @intCast(u64, @maximum(0, max_request_body_size.toInt64()));
+ args.max_request_body_size = @intCast(u64, @max(0, max_request_body_size.toInt64()));
}
if (arg.getTruthy(global, "error")) |onError| {
@@ -2515,7 +2515,7 @@ pub const WebSocketServer = struct {
globalObject.throwInvalidArguments("websocket expects maxPayloadLength to be an integer", .{});
return null;
}
- server.maxPayloadLength = @intCast(u32, @truncate(i33, @maximum(value.toInt64(), 0)));
+ server.maxPayloadLength = @intCast(u32, @truncate(i33, @max(value.toInt64(), 0)));
}
}
if (object.get(globalObject, "idleTimeout")) |value| {
@@ -2535,7 +2535,7 @@ pub const WebSocketServer = struct {
return null;
}
- server.backpressureLimit = @intCast(u32, @truncate(i33, @maximum(value.toInt64(), 0)));
+ server.backpressureLimit = @intCast(u32, @truncate(i33, @max(value.toInt64(), 0)));
}
}
// if (object.get(globalObject, "sendPings")) |value| {
diff --git a/src/bun.js/base.zig b/src/bun.js/base.zig
index cdaa788bc..167ffb26f 100644
--- a/src/bun.js/base.zig
+++ b/src/bun.js/base.zig
@@ -1421,12 +1421,12 @@ pub fn NewClassWithInstanceType(
var middle_padding: usize = 0;
if (property_names.len > 0) {
for (property_names) |prop| {
- middle_padding = @maximum(prop.len, middle_padding);
+ middle_padding = @max(prop.len, middle_padding);
}
}
if (function_names.len > 0) {
for (function_names[0..function_names.len]) |_name| {
- middle_padding = @maximum(std.mem.span(_name).len, middle_padding);
+ middle_padding = @max(std.mem.span(_name).len, middle_padding);
}
}
diff --git a/src/bun.js/bindings/bindings.zig b/src/bun.js/bindings/bindings.zig
index 3c6099740..9240ebf25 100644
--- a/src/bun.js/bindings/bindings.zig
+++ b/src/bun.js/bindings/bindings.zig
@@ -2802,7 +2802,7 @@ pub const JSValue = enum(JSValueReprInt) {
?*JSInternalPromise => asInternalPromise(this),
?*JSPromise => asPromise(this),
- u52 => @truncate(u52, @intCast(u64, @maximum(this.toInt64(), 0))),
+ u52 => @truncate(u52, @intCast(u64, @max(this.toInt64(), 0))),
u64 => toUInt64NoTruncate(this),
u8 => @truncate(u8, toU32(this)),
i16 => @truncate(i16, toInt32(this)),
@@ -3497,7 +3497,7 @@ pub const JSValue = enum(JSValueReprInt) {
}
pub inline fn toU32(this: JSValue) u32 {
- return @intCast(u32, @maximum(this.toInt32(), 0));
+ return @intCast(u32, @max(this.toInt32(), 0));
}
pub fn getLengthOfArray(this: JSValue, globalThis: *JSGlobalObject) u32 {
diff --git a/src/bun.js/javascript.zig b/src/bun.js/javascript.zig
index adcc33ab8..bb0e8d7b8 100644
--- a/src/bun.js/javascript.zig
+++ b/src/bun.js/javascript.zig
@@ -604,7 +604,7 @@ pub const VirtualMachine = struct {
@intCast(
u128,
// handle if they set their system clock to be before epoch
- @maximum(
+ @max(
std.time.nanoTimestamp(),
origin_relative_epoch,
),
@@ -1580,8 +1580,8 @@ pub const VirtualMachine = struct {
if (frames[i].position.isInvalid()) continue;
if (this.source_mappings.resolveMapping(
frames[i].source_url.slice(),
- @maximum(frames[i].position.line, 0),
- @maximum(frames[i].position.column_start, 0),
+ @max(frames[i].position.line, 0),
+ @max(frames[i].position.column_start, 0),
)) |mapping| {
frames[i].position.line = mapping.original.lines;
frames[i].position.column_start = mapping.original.columns;
@@ -1634,8 +1634,8 @@ pub const VirtualMachine = struct {
var top = &frames[0];
if (this.source_mappings.resolveMapping(
top.source_url.slice(),
- @maximum(top.position.line, 0),
- @maximum(top.position.column_start, 0),
+ @max(top.position.line, 0),
+ @max(top.position.column_start, 0),
)) |mapping| {
var log = logger.Log.init(default_allocator);
var errorable: ErrorableResolvedSource = undefined;
@@ -1684,8 +1684,8 @@ pub const VirtualMachine = struct {
if (frame.position.isInvalid()) continue;
if (this.source_mappings.resolveMapping(
frame.source_url.slice(),
- @maximum(frame.position.line, 0),
- @maximum(frame.position.column_start, 0),
+ @max(frame.position.line, 0),
+ @max(frame.position.column_start, 0),
)) |mapping| {
frame.position.line = mapping.original.lines;
frame.remapped = true;
@@ -1703,7 +1703,7 @@ pub const VirtualMachine = struct {
var line_numbers = exception.stack.source_lines_numbers[0..exception.stack.source_lines_len];
var max_line: i32 = -1;
- for (line_numbers) |line| max_line = @maximum(max_line, line);
+ for (line_numbers) |line| max_line = @max(max_line, line);
const max_line_number_pad = std.fmt.count("{d}", .{max_line});
var source_lines = exception.stack.sourceLineIterator();
diff --git a/src/bun.js/node/node_fs.zig b/src/bun.js/node/node_fs.zig
index 0abef19c0..edbe71586 100644
--- a/src/bun.js/node/node_fs.zig
+++ b/src/bun.js/node/node_fs.zig
@@ -2509,7 +2509,7 @@ pub const NodeFS = struct {
// 16 KB is high end of what is okay to use for stack space
// good thing we ask for absurdly large stack sizes
var buf: [16384]u8 = undefined;
- var remain = @intCast(u64, @maximum(stat_.size, 0));
+ var remain = @intCast(u64, @max(stat_.size, 0));
toplevel: while (remain > 0) {
const amt = switch (Syscall.read(src_fd, buf[0..@min(buf.len, remain)])) {
.result => |result| result,
@@ -2607,7 +2607,7 @@ pub const NodeFS = struct {
.err => |err| return Maybe(Return.CopyFile){ .err = err },
};
- var size = @intCast(usize, @maximum(stat_.size, 0));
+ var size = @intCast(usize, @max(stat_.size, 0));
defer {
_ = linux.ftruncate(dest_fd, @intCast(i64, @truncate(u63, wrote)));
@@ -3374,7 +3374,7 @@ pub const NodeFS = struct {
};
// For certain files, the size might be 0 but the file might still have contents.
- const size = @intCast(u64, @maximum(stat_.size, 0));
+ const size = @intCast(u64, @max(stat_.size, 0));
var buf = std.ArrayList(u8).init(bun.default_allocator);
buf.ensureTotalCapacityPrecise(size + 16) catch unreachable;
diff --git a/src/bun.js/node/syscall.zig b/src/bun.js/node/syscall.zig
index 705b263b6..105f9050d 100644
--- a/src/bun.js/node/syscall.zig
+++ b/src/bun.js/node/syscall.zig
@@ -556,7 +556,7 @@ pub const Error = struct {
const errno_values = std.enums.values(os.E);
var err = @enumToInt(os.E.SUCCESS);
for (errno_values) |errn| {
- err = @maximum(err, @enumToInt(errn));
+ err = @max(err, @enumToInt(errn));
}
break :brk err;
};
diff --git a/src/bun.js/node/types.zig b/src/bun.js/node/types.zig
index 075a80d3d..07ccc8dec 100644
--- a/src/bun.js/node/types.zig
+++ b/src/bun.js/node/types.zig
@@ -774,7 +774,7 @@ pub fn timeLikeFromJS(ctx: JSC.C.JSContextRef, value_: JSC.JSValue, exception: J
return null;
}
- return @floatToInt(TimeLike, @maximum(@floor(seconds), std.math.minInt(TimeLike)));
+ return @floatToInt(TimeLike, @max(@floor(seconds), std.math.minInt(TimeLike)));
}
pub fn modeFromJS(ctx: JSC.C.JSContextRef, value: JSC.JSValue, exception: JSC.C.ExceptionRef) ?Mode {
@@ -1128,9 +1128,9 @@ fn StatsLike(comptime name: [:0]const u8, comptime T: type) type {
.atime_ms = @truncate(T, @intCast(i64, if (atime.tv_nsec > 0) (@intCast(usize, atime.tv_nsec) / std.time.ns_per_ms) else 0)),
.mtime_ms = @truncate(T, @intCast(i64, if (mtime.tv_nsec > 0) (@intCast(usize, mtime.tv_nsec) / std.time.ns_per_ms) else 0)),
.ctime_ms = @truncate(T, @intCast(i64, if (ctime.tv_nsec > 0) (@intCast(usize, ctime.tv_nsec) / std.time.ns_per_ms) else 0)),
- .atime = @intToEnum(Date, @intCast(u64, @maximum(atime.tv_sec, 0))),
- .mtime = @intToEnum(Date, @intCast(u64, @maximum(mtime.tv_sec, 0))),
- .ctime = @intToEnum(Date, @intCast(u64, @maximum(ctime.tv_sec, 0))),
+ .atime = @intToEnum(Date, @intCast(u64, @max(atime.tv_sec, 0))),
+ .mtime = @intToEnum(Date, @intCast(u64, @max(mtime.tv_sec, 0))),
+ .ctime = @intToEnum(Date, @intCast(u64, @max(ctime.tv_sec, 0))),
// Linux doesn't include this info in stat
// maybe it does in statx, but do you really need birthtime? If you do please file an issue.
@@ -1142,7 +1142,7 @@ fn StatsLike(comptime name: [:0]const u8, comptime T: type) type {
.birthtime = if (Environment.isLinux)
@intToEnum(Date, 0)
else
- @intToEnum(Date, @intCast(u64, @maximum(stat_.birthtime().tv_sec, 0))),
+ @intToEnum(Date, @intCast(u64, @max(stat_.birthtime().tv_sec, 0))),
};
}
@@ -1949,7 +1949,7 @@ pub const Process = struct {
}
pub fn exit(_: *JSC.JSGlobalObject, code: i32) callconv(.C) void {
- std.os.exit(@truncate(u8, @intCast(u32, @maximum(code, 0))));
+ std.os.exit(@truncate(u8, @intCast(u32, @max(code, 0))));
}
pub export const Bun__version: [:0]const u8 = "v" ++ bun.Global.package_json_version;
diff --git a/src/bun.js/webcore/response.zig b/src/bun.js/webcore/response.zig
index fb2829122..a17ad38a6 100644
--- a/src/bun.js/webcore/response.zig
+++ b/src/bun.js/webcore/response.zig
@@ -351,7 +351,7 @@ pub const Response = struct {
if (args.nextEat()) |init| {
if (init.isUndefinedOrNull()) {} else if (init.isNumber()) {
- response.body.init.status_code = @intCast(u16, @min(@maximum(0, init.toInt32()), std.math.maxInt(u16)));
+ response.body.init.status_code = @intCast(u16, @min(@max(0, init.toInt32()), std.math.maxInt(u16)));
} else {
if (Body.Init.init(getAllocator(globalThis), globalThis, init, init.jsType()) catch null) |_init| {
response.body.init = _init;
@@ -397,7 +397,7 @@ pub const Response = struct {
if (args.nextEat()) |init| {
if (init.isUndefinedOrNull()) {} else if (init.isNumber()) {
- response.body.init.status_code = @intCast(u16, @min(@maximum(0, init.toInt32()), std.math.maxInt(u16)));
+ response.body.init.status_code = @intCast(u16, @min(@max(0, init.toInt32()), std.math.maxInt(u16)));
} else {
if (Body.Init.init(getAllocator(globalThis), globalThis, init, init.jsType()) catch null) |_init| {
response.body.init = _init;
@@ -2205,7 +2205,7 @@ pub const Blob = struct {
if (stat.size > 0 and std.os.S.ISREG(stat.mode)) {
this.size = @min(
- @truncate(SizeType, @intCast(SizeType, @maximum(@intCast(i64, stat.size), 0))),
+ @truncate(SizeType, @intCast(SizeType, @max(@intCast(i64, stat.size), 0))),
this.max_length,
);
// read up to 4k at a time if
@@ -2849,7 +2849,7 @@ pub const Blob = struct {
}
if (stat.size != 0) {
- this.max_length = @maximum(@min(@intCast(SizeType, stat.size), this.max_length), this.offset) - this.offset;
+ this.max_length = @max(@min(@intCast(SizeType, stat.size), this.max_length), this.offset) - this.offset;
if (this.max_length == 0) {
this.doClose();
return;
@@ -3001,7 +3001,7 @@ pub const Blob = struct {
return JSValue.jsUndefined();
}
- recommended_chunk_size = @intCast(SizeType, @maximum(0, @truncate(i52, arguments[0].toInt64())));
+ recommended_chunk_size = @intCast(SizeType, @max(0, @truncate(i52, arguments[0].toInt64())));
}
return JSC.WebCore.ReadableStream.fromBlob(
globalThis,
@@ -3162,7 +3162,7 @@ pub const Blob = struct {
const start = start_.toInt64();
if (start < 0) {
// If the optional start parameter is negative, let relativeStart be start + size.
- relativeStart = @intCast(i64, @maximum(start + @intCast(i64, this.size), 0));
+ relativeStart = @intCast(i64, @max(start + @intCast(i64, this.size), 0));
} else {
// Otherwise, let relativeStart be start.
relativeStart = @min(@intCast(i64, start), @intCast(i64, this.size));
@@ -3174,7 +3174,7 @@ pub const Blob = struct {
// If end is negative, let relativeEnd be max((size + end), 0).
if (end < 0) {
// If the optional start parameter is negative, let relativeStart be start + size.
- relativeEnd = @intCast(i64, @maximum(end + @intCast(i64, this.size), 0));
+ relativeEnd = @intCast(i64, @max(end + @intCast(i64, this.size), 0));
} else {
// Otherwise, let relativeStart be start.
relativeEnd = @min(@intCast(i64, end), @intCast(i64, this.size));
@@ -3193,7 +3193,7 @@ pub const Blob = struct {
}
}
- const len = @intCast(SizeType, @maximum(relativeEnd - relativeStart, 0));
+ const len = @intCast(SizeType, @max(relativeEnd - relativeStart, 0));
// This copies over the is_all_ascii flag
// which is okay because this will only be a <= slice
diff --git a/src/bun.js/webcore/streams.zig b/src/bun.js/webcore/streams.zig
index d0f196291..9bd8821dc 100644
--- a/src/bun.js/webcore/streams.zig
+++ b/src/bun.js/webcore/streams.zig
@@ -392,7 +392,7 @@ pub const StreamStart = union(Tag) {
if (value.get(globalThis, "highWaterMark")) |chunkSize| {
empty = false;
- chunk_size = @intCast(JSC.WebCore.Blob.SizeType, @maximum(0, @truncate(i51, chunkSize.toInt64())));
+ chunk_size = @intCast(JSC.WebCore.Blob.SizeType, @max(0, @truncate(i51, chunkSize.toInt64())));
}
if (!empty) {
@@ -409,7 +409,7 @@ pub const StreamStart = union(Tag) {
var chunk_size: JSC.WebCore.Blob.SizeType = 0;
if (value.get(globalThis, "highWaterMark")) |chunkSize| {
- chunk_size = @intCast(JSC.WebCore.Blob.SizeType, @maximum(0, @truncate(i51, chunkSize.toInt64())));
+ chunk_size = @intCast(JSC.WebCore.Blob.SizeType, @max(0, @truncate(i51, chunkSize.toInt64())));
}
if (value.get(globalThis, "path")) |path| {
@@ -445,7 +445,7 @@ pub const StreamStart = union(Tag) {
if (value.get(globalThis, "highWaterMark")) |chunkSize| {
empty = false;
- chunk_size = @intCast(JSC.WebCore.Blob.SizeType, @maximum(256, @truncate(i51, chunkSize.toInt64())));
+ chunk_size = @intCast(JSC.WebCore.Blob.SizeType, @max(256, @truncate(i51, chunkSize.toInt64())));
}
if (!empty) {
@@ -2823,7 +2823,7 @@ pub const ByteStream = struct {
return .{ .ready = void{} };
}
- return .{ .chunk_size = @maximum(this.highWaterMark, std.mem.page_size) };
+ return .{ .chunk_size = @max(this.highWaterMark, std.mem.page_size) };
}
pub fn value(this: *@This()) JSValue {
@@ -3149,7 +3149,7 @@ pub const FileBlobLoader = struct {
this.pending.result = .{
.err = Syscall.Error{
// this is too hacky
- .errno = @truncate(Syscall.Error.Int, @intCast(u16, @maximum(1, @errorToInt(err)))),
+ .errno = @truncate(Syscall.Error.Int, @intCast(u16, @max(1, @errorToInt(err)))),
.syscall = .read,
},
};
@@ -3390,7 +3390,7 @@ pub const FileBlobLoader = struct {
@as(usize, default_fifo_chunk_size);
return if (file.max_size > 0)
- if (available_to_read != std.math.maxInt(usize)) @min(chunk_size, available_to_read) else @min(@maximum(this.total_read, file.max_size) - this.total_read, chunk_size)
+ if (available_to_read != std.math.maxInt(usize)) @min(chunk_size, available_to_read) else @min(@max(this.total_read, file.max_size) - this.total_read, chunk_size)
else
@min(available_to_read, chunk_size);
}
@@ -3641,9 +3641,9 @@ pub const FileBlobLoader = struct {
// Returns when the file pointer is not at the end of
// file. data contains the offset from current position
// to end of file, and may be negative.
- available_to_read = @intCast(usize, @maximum(sizeOrOffset, 0));
+ available_to_read = @intCast(usize, @max(sizeOrOffset, 0));
} else if (std.os.S.ISCHR(this.mode) or std.os.S.ISFIFO(this.mode)) {
- available_to_read = @intCast(usize, @maximum(sizeOrOffset, 0));
+ available_to_read = @intCast(usize, @max(sizeOrOffset, 0));
}
}
if (this.finalized and this.scheduled_count == 0) {
diff --git a/src/cli.zig b/src/cli.zig
index 0e79b1e21..f0e7526b5 100644
--- a/src/cli.zig
+++ b/src/cli.zig
@@ -743,7 +743,7 @@ pub const HelpCommand = struct {
\\
;
- var rand = std.rand.DefaultPrng.init(@intCast(u64, @maximum(std.time.milliTimestamp(), 0))).random();
+ var rand = std.rand.DefaultPrng.init(@intCast(u64, @max(std.time.milliTimestamp(), 0))).random();
const package_add_i = rand.uintAtMost(usize, packages_to_add_filler.len - 1);
const package_remove_i = rand.uintAtMost(usize, packages_to_remove_filler.len - 1);
diff --git a/src/cli/add_completions.zig b/src/cli/add_completions.zig
index b8001884d..95201659d 100644
--- a/src/cli/add_completions.zig
+++ b/src/cli/add_completions.zig
@@ -78,7 +78,7 @@ pub const biggest_list: usize = brk: {
var iter = a.iterator();
var max: usize = 0;
while (iter.next()) |list| {
- max = @maximum(list.value.len, max);
+ max = @max(list.value.len, max);
}
break :brk max;
};
diff --git a/src/cli/upgrade_command.zig b/src/cli/upgrade_command.zig
index b77f90fc5..28d323287 100644
--- a/src/cli/upgrade_command.zig
+++ b/src/cli/upgrade_command.zig
@@ -118,7 +118,7 @@ pub const UpgradeCheckerThread = struct {
}
fn _run(env_loader: *DotEnv.Loader) anyerror!void {
- var rand = std.rand.DefaultPrng.init(@intCast(u64, @maximum(std.time.milliTimestamp(), 0)));
+ var rand = std.rand.DefaultPrng.init(@intCast(u64, @max(std.time.milliTimestamp(), 0)));
const delay = rand.random().intRangeAtMost(u64, 100, 10000);
std.time.sleep(std.time.ns_per_ms * delay);
@@ -353,7 +353,7 @@ pub const UpgradeCommand = struct {
if (asset.asProperty("size")) |size_| {
if (size_.expr.data == .e_number) {
- version.size = @intCast(u32, @maximum(@floatToInt(i32, std.math.ceil(size_.expr.data.e_number.value)), 0));
+ version.size = @intCast(u32, @max(@floatToInt(i32, std.math.ceil(size_.expr.data.e_number.value)), 0));
}
}
return version;
@@ -458,7 +458,7 @@ pub const UpgradeCommand = struct {
refresher.refresh();
var async_http = ctx.allocator.create(HTTP.AsyncHTTP) catch unreachable;
var zip_file_buffer = try ctx.allocator.create(MutableString);
- zip_file_buffer.* = try MutableString.init(ctx.allocator, @maximum(version.size, 1024));
+ zip_file_buffer.* = try MutableString.init(ctx.allocator, @max(version.size, 1024));
async_http.* = HTTP.AsyncHTTP.initSync(
ctx.allocator,
diff --git a/src/css_scanner.zig b/src/css_scanner.zig
index c48a54441..2a56d818c 100644
--- a/src/css_scanner.zig
+++ b/src/css_scanner.zig
@@ -1248,7 +1248,7 @@ pub fn NewBundler(
try this.writer.done();
return CodeCount{
- .written = @intCast(usize, @maximum(this.writer.written - start_count, 0)),
+ .written = @intCast(usize, @max(this.writer.written - start_count, 0)),
.approximate_newline_count = lines_of_code,
};
}
diff --git a/src/fs.zig b/src/fs.zig
index 2392a396f..5edd3a301 100644
--- a/src/fs.zig
+++ b/src/fs.zig
@@ -127,7 +127,7 @@ pub const FileSystem = struct {
return;
}
- max_fd = @maximum(fd, max_fd);
+ max_fd = @max(fd, max_fd);
}
pub var instance_loaded: bool = false;
pub var instance: FileSystem = undefined;
diff --git a/src/http.zig b/src/http.zig
index a56594b9c..41e3f8af3 100644
--- a/src/http.zig
+++ b/src/http.zig
@@ -3445,7 +3445,7 @@ pub const Server = struct {
server.websocket_threadpool.stack_size = @truncate(
u32,
@min(
- @maximum(128_000, Fs.FileSystem.RealFS.Limit.stack),
+ @max(128_000, Fs.FileSystem.RealFS.Limit.stack),
4_000_000,
),
);
diff --git a/src/http/url_path.zig b/src/http/url_path.zig
index 58bc06075..1565db00a 100644
--- a/src/http/url_path.zig
+++ b/src/http/url_path.zig
@@ -97,7 +97,7 @@ pub fn parse(possibly_encoded_pathname_: string) !URLPath {
switch (c) {
'?' => {
- question_mark_i = @maximum(question_mark_i, i);
+ question_mark_i = @max(question_mark_i, i);
if (question_mark_i < period_i) {
period_i = -1;
}
@@ -107,10 +107,10 @@ pub fn parse(possibly_encoded_pathname_: string) !URLPath {
}
},
'.' => {
- period_i = @maximum(period_i, i);
+ period_i = @max(period_i, i);
},
'/' => {
- last_slash = @maximum(last_slash, i);
+ last_slash = @max(last_slash, i);
if (i > 0) {
first_segment_end = @min(first_segment_end, i);
diff --git a/src/http_client_async.zig b/src/http_client_async.zig
index 2d85607e8..57726b87c 100644
--- a/src/http_client_async.zig
+++ b/src/http_client_async.zig
@@ -428,7 +428,7 @@ pub const HTTPThread = struct {
}
fn processEvents_(this: *@This()) void {
- this.loop.num_polls = @maximum(2, this.loop.num_polls);
+ this.loop.num_polls = @max(2, this.loop.num_polls);
while (true) {
this.drainEvents();
diff --git a/src/install/install.zig b/src/install/install.zig
index d13773a5a..ea926197c 100644
--- a/src/install/install.zig
+++ b/src/install/install.zig
@@ -3154,7 +3154,7 @@ pub const PackageManager = struct {
entry.value_ptr.* = manifest;
if (timestamp_this_tick == null) {
- timestamp_this_tick = @truncate(u32, @intCast(u64, @maximum(0, std.time.timestamp()))) +| 300;
+ timestamp_this_tick = @truncate(u32, @intCast(u64, @max(0, std.time.timestamp()))) +| 300;
}
entry.value_ptr.*.pkg.public_max_age = timestamp_this_tick.?;
@@ -3779,7 +3779,7 @@ pub const PackageManager = struct {
if (env_loader.map.get("BUN_CONFIG_HTTP_RETRY_COUNT")) |retry_count| {
if (std.fmt.parseInt(i32, retry_count, 10)) |int| {
- this.max_retry_count = @intCast(u16, @min(@maximum(int, 0), 65355));
+ this.max_retry_count = @intCast(u16, @min(@max(int, 0), 65355));
} else |_| {}
}
@@ -4331,7 +4331,7 @@ pub const PackageManager = struct {
ctx.install,
);
- manager.timestamp_for_manifest_cache_control = @truncate(u32, @intCast(u64, @maximum(std.time.timestamp(), 0)));
+ manager.timestamp_for_manifest_cache_control = @truncate(u32, @intCast(u64, @max(std.time.timestamp(), 0)));
return manager;
}
@@ -4417,7 +4417,7 @@ pub const PackageManager = struct {
u32,
@intCast(
u64,
- @maximum(
+ @max(
std.time.timestamp(),
0,
),
@@ -6623,7 +6623,7 @@ pub const PackageManager = struct {
var printed_timestamp = false;
if (install_summary.success > 0) {
// it's confusing when it shows 3 packages and says it installed 1
- Output.pretty("\n <green>{d}<r> packages<r> installed ", .{@maximum(
+ Output.pretty("\n <green>{d}<r> packages<r> installed ", .{@max(
install_summary.success,
@truncate(
u32,
diff --git a/src/install/integrity.zig b/src/install/integrity.zig
index bd4981b74..25eb25b93 100644
--- a/src/install/integrity.zig
+++ b/src/install/integrity.zig
@@ -20,7 +20,7 @@ pub const Integrity = extern struct {
var value: usize = 0;
for (values) |val| {
- value = @maximum(val, value);
+ value = @max(val, value);
}
break :brk value;
diff --git a/src/install/npm.zig b/src/install/npm.zig
index 2be84624c..d8a763ce2 100644
--- a/src/install/npm.zig
+++ b/src/install/npm.zig
@@ -208,7 +208,7 @@ pub const Registry = struct {
package_name,
newly_last_modified,
new_etag,
- @truncate(u32, @intCast(u64, @maximum(0, std.time.timestamp()))) + 300,
+ @truncate(u32, @intCast(u64, @max(0, std.time.timestamp()))) + 300,
)) |package| {
if (package_manager.options.enable.manifest_cache) {
PackageManifest.Serializer.save(&package, package_manager.getTemporaryDirectory(), package_manager.getCacheDirectory()) catch {};
@@ -556,7 +556,7 @@ pub const PackageManifest = struct {
var out_path_buf: ["-18446744073709551615".len + ".npm".len + 1]u8 = undefined;
var dest_path_stream = std.io.fixedBufferStream(&dest_path_buf);
var dest_path_stream_writer = dest_path_stream.writer();
- try dest_path_stream_writer.print("{x}.npm-{x}", .{ file_id, @maximum(std.time.milliTimestamp(), 0) });
+ try dest_path_stream_writer.print("{x}.npm-{x}", .{ file_id, @max(std.time.milliTimestamp(), 0) });
try dest_path_stream_writer.writeByte(0);
var tmp_path: [:0]u8 = dest_path_buf[0 .. dest_path_stream.pos - 1 :0];
try writeFile(this, tmp_path, tmpdir);
@@ -620,15 +620,15 @@ pub const PackageManifest = struct {
pub fn reportSize(this: *const PackageManifest) void {
Output.prettyErrorln(
- \\ Versions count: {d}
- \\ External Strings count: {d}
+ \\ Versions count: {d}
+ \\ External Strings count: {d}
\\ Package Versions count: {d}
- \\
+ \\
\\ Bytes:
\\
- \\ Versions: {d}
- \\ External: {d}
- \\ Packages: {d}
+ \\ Versions: {d}
+ \\ External: {d}
+ \\ Packages: {d}
\\ Strings: {d}
\\ Total: {d}
, .{
diff --git a/src/install/resolvers/folder_resolver.zig b/src/install/resolvers/folder_resolver.zig
index b48600747..4438ca415 100644
--- a/src/install/resolvers/folder_resolver.zig
+++ b/src/install/resolvers/folder_resolver.zig
@@ -134,7 +134,7 @@ pub const FolderResolution = union(Tag) {
const len = try package_json.getEndPos();
body.data.reset();
- body.data.inflate(@maximum(len, 2048)) catch unreachable;
+ body.data.inflate(@max(len, 2048)) catch unreachable;
body.data.list.expandToCapacity();
const source_buf = try package_json.readAll(body.data.list.items);
diff --git a/src/js_ast.zig b/src/js_ast.zig
index 0bd73c93f..c0acd74da 100644
--- a/src/js_ast.zig
+++ b/src/js_ast.zig
@@ -1236,22 +1236,22 @@ pub const E = struct {
pub inline fn toU64(self: Number) u64 {
@setRuntimeSafety(false);
- return @floatToInt(u64, @maximum(@trunc(self.value), 0));
+ return @floatToInt(u64, @max(@trunc(self.value), 0));
}
pub inline fn toUsize(self: Number) usize {
@setRuntimeSafety(false);
- return @floatToInt(usize, @maximum(@trunc(self.value), 0));
+ return @floatToInt(usize, @max(@trunc(self.value), 0));
}
pub inline fn toU32(self: Number) u32 {
@setRuntimeSafety(false);
- return @floatToInt(u32, @maximum(@trunc(self.value), 0));
+ return @floatToInt(u32, @max(@trunc(self.value), 0));
}
pub inline fn toU16(self: Number) u16 {
@setRuntimeSafety(false);
- return @floatToInt(u16, @maximum(@trunc(self.value), 0));
+ return @floatToInt(u16, @max(@trunc(self.value), 0));
}
pub fn jsonStringify(self: *const Number, opts: anytype, o: anytype) !void {
@@ -8120,7 +8120,7 @@ pub const Macro = struct {
// Give it >= 256 KB stack space
// Cast to usize to ensure we get an 8 byte aligned pointer
- const PooledFrame = ObjectPool([@maximum(@sizeOf(@Frame(Run.runAsync)), 1024 * 1024 * 2) / @sizeOf(usize)]usize, null, true, 1);
+ const PooledFrame = ObjectPool([@max(@sizeOf(@Frame(Run.runAsync)), 1024 * 1024 * 2) / @sizeOf(usize)]usize, null, true, 1);
var pooled_frame = PooledFrame.get(default_allocator);
defer pooled_frame.release();
diff --git a/src/js_printer.zig b/src/js_printer.zig
index f5614d5f5..ad5be8b23 100644
--- a/src/js_printer.zig
+++ b/src/js_printer.zig
@@ -4724,7 +4724,7 @@ pub fn NewWriter(
pub const Error = error{FormatError};
pub fn writeAll(writer: *Self, bytes: anytype) Error!usize {
- const written = @maximum(writer.written, 0);
+ const written = @max(writer.written, 0);
writer.print(@TypeOf(bytes), bytes);
return @intCast(usize, writer.written) - @intCast(usize, written);
}
@@ -5080,7 +5080,7 @@ pub fn printAst(
try printer.writer.done();
- return @intCast(usize, @maximum(printer.writer.written, 0));
+ return @intCast(usize, @max(printer.writer.written, 0));
}
pub fn printJSON(
@@ -5114,7 +5114,7 @@ pub fn printJSON(
}
try printer.writer.done();
- return @intCast(usize, @maximum(printer.writer.written, 0));
+ return @intCast(usize, @max(printer.writer.written, 0));
}
pub fn printCommonJS(
@@ -5172,7 +5172,7 @@ pub fn printCommonJS(
try printer.writer.done();
- return @intCast(usize, @maximum(printer.writer.written, 0));
+ return @intCast(usize, @max(printer.writer.written, 0));
}
pub const WriteResult = struct {
@@ -5257,7 +5257,7 @@ pub fn printCommonJSThreaded(
@atomicStore(u32, end_off_ptr, result.end_off, .SeqCst);
}
- result.len = @intCast(usize, @maximum(printer.writer.written, 0));
+ result.len = @intCast(usize, @max(printer.writer.written, 0));
return result;
}
diff --git a/src/libarchive/libarchive.zig b/src/libarchive/libarchive.zig
index 1ec9a1f37..bb900639f 100644
--- a/src/libarchive/libarchive.zig
+++ b/src/libarchive/libarchive.zig
@@ -569,7 +569,7 @@ pub const Archive = struct {
};
defer if (comptime close_handles) file.close();
- const entry_size = @maximum(lib.archive_entry_size(entry), 0);
+ const entry_size = @max(lib.archive_entry_size(entry), 0);
const size = @intCast(usize, entry_size);
if (size > 0) {
if (ctx) |ctx_| {
diff --git a/src/logger.zig b/src/logger.zig
index 75309c843..03cbc6c20 100644
--- a/src/logger.zig
+++ b/src/logger.zig
@@ -73,7 +73,7 @@ pub const Loc = packed struct {
pub const toUsize = i;
pub inline fn i(self: *const Loc) usize {
- return @intCast(usize, @maximum(self.start, 0));
+ return @intCast(usize, @max(self.start, 0));
}
pub const Empty = Loc{ .start = -1 };
@@ -1231,7 +1231,7 @@ pub const Source = struct {
pub fn initErrorPosition(self: *const Source, _offset: Loc) ErrorPosition {
var prev_code_point: i32 = 0;
- var offset: usize = std.math.min(if (_offset.start < 0) 0 else @intCast(usize, _offset.start), @maximum(self.contents.len, 1) - 1);
+ var offset: usize = std.math.min(if (_offset.start < 0) 0 else @intCast(usize, _offset.start), @max(self.contents.len, 1) - 1);
const contents = self.contents;
diff --git a/src/mdx/mdx_parser.zig b/src/mdx/mdx_parser.zig
index c46b43f8f..f79fc8035 100644
--- a/src/mdx/mdx_parser.zig
+++ b/src/mdx/mdx_parser.zig
@@ -1797,7 +1797,7 @@ pub const MDX = struct {
var root_children = std.ArrayListUnmanaged(Expr){};
var first_loc = try run(this, &root_children);
- first_loc.start = @maximum(first_loc.start, 0);
+ first_loc.start = @max(first_loc.start, 0);
const args_loc = first_loc;
first_loc.start += 1;
const body_loc = first_loc;
diff --git a/src/network_thread.zig b/src/network_thread.zig
index f48e94e5a..a3baebacb 100644
--- a/src/network_thread.zig
+++ b/src/network_thread.zig
@@ -34,27 +34,27 @@ pub fn onStartIOThread(waker: AsyncIO.Waker) void {
if (comptime Environment.isLinux) {
if (err == error.SystemOutdated) {
Output.prettyErrorln(
- \\<red>error<r>: Linux kernel version doesn't support io_uring, which Bun depends on.
+ \\<red>error<r>: Linux kernel version doesn't support io_uring, which Bun depends on.
\\
\\ To fix this error: please upgrade to a newer Linux kernel.
- \\
+ \\
\\ If you're using Windows Subsystem for Linux, here's how:
\\ 1. Open PowerShell as an administrator
\\ 2. Run this:
\\ wsl --update
\\ wsl --shutdown
- \\
+ \\
\\ Please make sure you're using WSL version 2 (not WSL 1). To check: wsl -l -v
\\ If you are on WSL 1, update to WSL 2 with the following commands:
\\ 1. wsl --set-default-version 2
\\ 2. wsl --set-version [distro_name] 2
\\ 3. Now follow the WSL 2 instructions above.
\\ Where [distro_name] is one of the names from the list given by: wsl -l -v
- \\
+ \\
\\ If that doesn't work (and you're on a Windows machine), try this:
\\ 1. Open Windows Update
\\ 2. Download any updates to Windows Subsystem for Linux
- \\
+ \\
\\ If you're still having trouble, ask for help in bun's discord https://bun.sh/discord
, .{});
break :log;
@@ -65,7 +65,7 @@ pub fn onStartIOThread(waker: AsyncIO.Waker) void {
\\To fix this error: <b>please increase the memlock limit<r> or upgrade to Linux kernel 5.11+
\\
\\If Bun is running inside Docker, make sure to set the memlock limit to unlimited (-1)
- \\
+ \\
\\ docker run --rm --init --ulimit memlock=-1:-1 jarredsumner/bun:edge
\\
\\To bump the memlock limit, check one of the following:
@@ -203,7 +203,7 @@ pub const AddressListCache = std.HashMap(u64, CachedAddressList, IdentityContext
pub var address_list_cached: AddressListCache = undefined;
pub fn getAddressList(allocator: std.mem.Allocator, name: []const u8, port: u16) !*std.net.AddressList {
// const hash = CachedAddressList.hash(name, port);
- // const now = @intCast(u64, @maximum(0, std.time.milliTimestamp()));
+ // const now = @intCast(u64, @max(0, std.time.milliTimestamp()));
// if (address_list_cached.getPtr(hash)) |cached| {
// if (cached.expire_after > now) {
// return cached;
diff --git a/src/report.zig b/src/report.zig
index 79e60f5be..f1ded3598 100644
--- a/src/report.zig
+++ b/src/report.zig
@@ -69,7 +69,7 @@ pub const CrashReportWriter = struct {
const file_path = std.fmt.bufPrintZ(
&crash_reporter_path,
"{s}/.bun-crash/v{s}-{d}.crash",
- .{ base_dir, Global.package_json_version, @intCast(u64, @maximum(std.time.milliTimestamp(), 0)) },
+ .{ base_dir, Global.package_json_version, @intCast(u64, @max(std.time.milliTimestamp(), 0)) },
) catch return;
std.fs.cwd().makeDir(std.fs.path.dirname(std.mem.span(file_path)).?) catch {};
@@ -192,7 +192,7 @@ pub fn fatal(err_: ?anyerror, msg_: ?string) void {
if (msg_) |msg| {
const msg_ptr = @ptrToInt(msg.ptr);
if (msg_ptr > 0) {
- const len = @maximum(@min(msg.len, 1024), 0);
+ const len = @max(@min(msg.len, 1024), 0);
if (len > 0) {
if (Output.isEmojiEnabled()) {
@@ -296,7 +296,7 @@ pub noinline fn handleCrash(signal: i32, addr: usize) void {
}
}
- std.c._exit(128 + @truncate(u8, @intCast(u8, @maximum(signal, 0))));
+ std.c._exit(128 + @truncate(u8, @intCast(u8, @max(signal, 0))));
}
pub noinline fn globalError(err: anyerror) noreturn {
diff --git a/src/router.zig b/src/router.zig
index dac234faa..fa1a6d13b 100644
--- a/src/router.zig
+++ b/src/router.zig
@@ -500,8 +500,8 @@ pub const TinyPtr = packed struct {
std.debug.assert(end < right);
}
- const length = @maximum(end, right) - right;
- const offset = @maximum(@ptrToInt(in.ptr), @ptrToInt(parent.ptr)) - @ptrToInt(parent.ptr);
+ const length = @max(end, right) - right;
+ const offset = @max(@ptrToInt(in.ptr), @ptrToInt(parent.ptr)) - @ptrToInt(parent.ptr);
return TinyPtr{ .offset = @truncate(u16, offset), .len = @truncate(u16, length) };
}
};
@@ -1214,7 +1214,7 @@ const Pattern = struct {
return null;
};
offset = pattern.len;
- kind = @maximum(@enumToInt(@as(Pattern.Tag, pattern.value)), kind);
+ kind = @max(@enumToInt(@as(Pattern.Tag, pattern.value)), kind);
count += @intCast(u16, @boolToInt(@enumToInt(@as(Pattern.Tag, pattern.value)) > @enumToInt(Pattern.Tag.static)));
}
diff --git a/src/sourcemap/sourcemap.zig b/src/sourcemap/sourcemap.zig
index 84545b977..c96b1e0b9 100644
--- a/src/sourcemap/sourcemap.zig
+++ b/src/sourcemap/sourcemap.zig
@@ -617,7 +617,7 @@ pub const LineOffsetTable = struct {
pub fn generate(allocator: std.mem.Allocator, contents: []const u8, approximate_line_count: i32) List {
var list = List{};
// Preallocate the top-level table using the approximate line count from the lexer
- list.ensureUnusedCapacity(allocator, @intCast(usize, @maximum(approximate_line_count, 1))) catch unreachable;
+ list.ensureUnusedCapacity(allocator, @intCast(usize, @max(approximate_line_count, 1))) catch unreachable;
var column: i32 = 0;
var byte_offset_to_first_non_ascii: u32 = 0;
var column_byte_offset: u32 = 0;
@@ -676,7 +676,7 @@ pub const LineOffsetTable = struct {
}
} else {
switch (c) {
- (@maximum('\r', '\n') + 1)...127 => {
+ (@max('\r', '\n') + 1)...127 => {
// skip ahead to the next newline or non-ascii character
if (strings.indexOfNewlineOrNonASCIICheckStart(remaining, @as(u32, len_), false)) |j| {
column += @intCast(i32, j);
@@ -1094,7 +1094,7 @@ pub const Chunk = struct {
b.prev_loc = loc;
const list = b.line_offset_tables;
const original_line = LineOffsetTable.findLine(list, loc);
- const line = list.get(@intCast(usize, @maximum(original_line, 0)));
+ const line = list.get(@intCast(usize, @max(original_line, 0)));
// Use the line to compute the column
var original_column = loc.start - @intCast(i32, line.byte_offset_to_start_of_line);
diff --git a/src/string_immutable.zig b/src/string_immutable.zig
index 8b9f50dcc..b36f85ed3 100644
--- a/src/string_immutable.zig
+++ b/src/string_immutable.zig
@@ -958,7 +958,7 @@ pub fn toUTF16Alloc(allocator: std.mem.Allocator, bytes: []const u8, comptime fa
}
}
- remaining = remaining[@maximum(replacement.len, 1)..];
+ remaining = remaining[@max(replacement.len, 1)..];
const new_len = strings.u16Len(replacement.code_point);
try output.ensureUnusedCapacity(new_len);
output.items.len += @as(usize, new_len);
@@ -993,7 +993,7 @@ pub fn toUTF16Alloc(allocator: std.mem.Allocator, bytes: []const u8, comptime fa
}
}
- remaining = remaining[@maximum(replacement.len, 1)..];
+ remaining = remaining[@max(replacement.len, 1)..];
const new_len = j + @as(usize, strings.u16Len(replacement.code_point));
try output.ensureUnusedCapacity(new_len);
output.items.len += new_len;
diff --git a/src/string_types.zig b/src/string_types.zig
index d7e95b3f7..a9f0d2e25 100644
--- a/src/string_types.zig
+++ b/src/string_types.zig
@@ -103,7 +103,7 @@ pub const HashedString = struct {
pub fn Eql(this: HashedString, comptime Other: type, other: Other) bool {
switch (comptime Other) {
HashedString, *HashedString, *const HashedString => {
- return ((@maximum(this.hash, other.hash) > 0 and this.hash == other.hash) or (this.ptr == other.ptr)) and this.len == other.len;
+ return ((@max(this.hash, other.hash) > 0 and this.hash == other.hash) or (this.ptr == other.ptr)) and this.len == other.len;
},
else => {
return @as(usize, this.len) == other.len and @truncate(u32, std.hash.Wyhash.hash(0, other[0..other.len])) == this.hash;
diff --git a/src/url.zig b/src/url.zig
index 7e4772079..56cc8182a 100644
--- a/src/url.zig
+++ b/src/url.zig
@@ -843,7 +843,7 @@ fn stringPointerFromStrings(parent: string, in: string) Api.StringPointer {
if (in_end < end) return Api.StringPointer{};
return Api.StringPointer{
- .offset = @truncate(u32, @maximum(@ptrToInt(in.ptr), @ptrToInt(parent.ptr)) - @ptrToInt(parent.ptr)),
+ .offset = @truncate(u32, @max(@ptrToInt(in.ptr), @ptrToInt(parent.ptr)) - @ptrToInt(parent.ptr)),
.length = @truncate(u32, in.len),
};
}
diff --git a/src/watcher.zig b/src/watcher.zig
index d21aa4aaf..e627e4b51 100644
--- a/src/watcher.zig
+++ b/src/watcher.zig
@@ -436,7 +436,7 @@ pub fn NewWatcher(comptime ContextType: type) type {
null,
);
- var changes = changelist[0..@intCast(usize, @maximum(0, count_))];
+ var changes = changelist[0..@intCast(usize, @max(0, count_))];
var watchevents = this.watch_events[0..changes.len];
for (changes) |event, i| {
watchevents[i].fromKEvent(event);
diff --git a/src/work_pool.zig b/src/work_pool.zig
index 9ddf106e9..364ca8abe 100644
--- a/src/work_pool.zig
+++ b/src/work_pool.zig
@@ -13,7 +13,7 @@ pub fn NewWorkPool(comptime max_threads: ?usize) type {
@setCold(true);
pool = ThreadPool.init(.{
- .max_threads = max_threads orelse @floatToInt(u32, @floor(@intToFloat(f32, @maximum(std.Thread.getCpuCount() catch 0, 2)) * 0.8)),
+ .max_threads = max_threads orelse @floatToInt(u32, @floor(@intToFloat(f32, @max(std.Thread.getCpuCount() catch 0, 2)) * 0.8)),
.stack_size = 2 * 1024 * 1024,
});
return &pool;