Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zig 0.10.0 #1491

Closed
wants to merge 51 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
fd0398b
Rename `@maximum` and `@minimum` to `@max` and `@min`
vjpr Nov 11, 2022
521cbfc
empty test name must be omitted
vjpr Nov 11, 2022
101997f
Fix: invalid builtin function: '@maximum'
vjpr Nov 11, 2022
bf86fe9
Fix: number '0000010' has leading zero
vjpr Nov 11, 2022
e73b048
Fix: number '0000010' has leading zero
vjpr Nov 11, 2022
c7dc0ce
Fix: capture shadows declaration of 'str'
vjpr Nov 11, 2022
6dfd997
Fix: pointless discard of function parameter
vjpr Nov 11, 2022
8ea8120
Fix: @ctz - expected 1 argument, found 2
vjpr Nov 11, 2022
5c8b61f
Fix: @ctz - expected 1 argument, found 2
vjpr Nov 11, 2022
b4b4374
Fix: @ctz - expected 1 argument, found 2
vjpr Nov 11, 2022
1eca6e6
Fix: @ctz - expected 1 argument, found 2
vjpr Nov 11, 2022
a8440dd
Fix: @ctz - expected 1 argument, found 2
vjpr Nov 11, 2022
87f91bd
Fix: @ctz - expected 1 argument, found 2
vjpr Nov 12, 2022
de56b55
Fix: declaration 'Type' shadows function parameter from outer scope
vjpr Nov 12, 2022
206bb5d
Fix: empty test name must be omitted
vjpr Nov 12, 2022
cafe22a
Fix: octal has leading zeros
vjpr Nov 12, 2022
bfee096
Fix: @ctz - expected 1 argument, found 2
vjpr Nov 12, 2022
00ca7a9
Fix: @ctz/@popCount - expected 1 argument, found 2
vjpr Nov 12, 2022
693167c
Fix: shadowing
vjpr Nov 12, 2022
a2a0480
Fix: shadowing
vjpr Nov 12, 2022
7588850
Fix: shadowing
vjpr Nov 12, 2022
83fdc45
Fix: unused
vjpr Nov 12, 2022
1818662
Fix: undo mistake
vjpr Nov 12, 2022
58e73e1
Fix: function type cannot have a name
vjpr Nov 12, 2022
379e118
Fix: unused stuff
vjpr Nov 12, 2022
0cf1a49
Fix: addIncludeDir -> addIncludeDir
vjpr Nov 12, 2022
e1d19a7
Fix: openDirIterable
vjpr Nov 12, 2022
8029ee6
Fix: addLibPath -> addLibraryPath
vjpr Nov 12, 2022
1e7e971
Fix: Dir.Entry -> IterableDir.Entry
vjpr Nov 12, 2022
ffcdad0
Fix: leading zeroes
vjpr Nov 12, 2022
c020fe5
Fix: Shadowing
vjpr Nov 12, 2022
e0d9423
Fix: Ambiguous references
vjpr Nov 12, 2022
ca05e19
Fix: empty test name
vjpr Nov 12, 2022
ab9c164
Fix: ambiguous errors
vjpr Nov 12, 2022
e4fe2d9
Fix: builtin.TypeInfo -> builtin.Type
vjpr Nov 12, 2022
eec7402
Fix: Makefile flags
vjpr Nov 12, 2022
878102c
Fix: optional string fmt
vjpr Nov 12, 2022
580107d
Fix: fmt {s} -> {any}
vjpr Nov 12, 2022
f25d48c
Fix: fmt fixing
vjpr Nov 12, 2022
7f2fa8c
Fix: makeOpenPath -> makeOpenPathIterable
vjpr Nov 12, 2022
aec0b18
Fix: IterableDir
vjpr Nov 12, 2022
7b5cfae
Fix: unable to evaluate constant expression
vjpr Nov 13, 2022
b17348e
Fix: shadowing closure param
vjpr Nov 13, 2022
66dd930
Fix: IterableDir stuff
vjpr Nov 14, 2022
ef6fc1c
Fix: posix_spawnattr_destroy
vjpr Nov 14, 2022
9ed2f8d
string stuff
vjpr Nov 14, 2022
9808e5f
revert some string format changes
vjpr Nov 14, 2022
eb4724f
revert some string format changes
vjpr Nov 14, 2022
3c84444
@alignCast
vjpr Nov 14, 2022
ab5253c
revert some string format changes
vjpr Nov 14, 2022
98df9d7
Fix: IterableDir stuff
vjpr Nov 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ WEBKIT_RELEASE_DIR_LTO ?= $(WEBKIT_DIR)/WebKitBuild/ReleaseLTO

NPM_CLIENT ?= $(shell which bun || which npm)
ZIG ?= $(shell which zig || echo -e "error: Missing zig. Please make sure zig is in PATH. Or set ZIG=/path/to-zig-executable")
ZIG_FLAGS ?= "-fstage1"

# We must use the same compiler version for the JavaScriptCore bindings and JavaScriptCore
# If we don't do this, strange memory allocation failures occur.
Expand Down Expand Up @@ -377,7 +378,7 @@ endif
SHARED_LIB_EXTENSION = .so

JSC_BINDINGS = $(BINDINGS_OBJ) $(JSC_FILES)
JSC_BINDINGS_DEBUG = $(DEBUG_BINDINGS_OBJ) $(JSC_FILES_DEBUG)
JSC_BINDINGS_DEBUG = $(DEBUG_BINDINGS_OBJ) $(JSC_FILES_DEBUG)

RELEASE_FLAGS=
DEBUG_FLAGS=
Expand Down Expand Up @@ -405,7 +406,7 @@ ARCHIVE_FILES_WITHOUT_LIBCRYPTO = $(MINIMUM_ARCHIVE_FILES) \
-lusockets \
$(BUN_DEPS_OUT_DIR)/libuwsockets.o

ARCHIVE_FILES = $(ARCHIVE_FILES_WITHOUT_LIBCRYPTO)
ARCHIVE_FILES = $(ARCHIVE_FILES_WITHOUT_LIBCRYPTO)

STATIC_MUSL_FLAG ?=

Expand All @@ -426,9 +427,9 @@ PLATFORM_LINKER_FLAGS = $(BUN_CFLAGS) \
-flto \
-Wl,--allow-multiple-definition \
-rdynamic





endif


Expand Down Expand Up @@ -870,7 +871,7 @@ CLANG_FORMAT := $(shell command -v clang-format 2> /dev/null)
headers:
rm -f /tmp/build-jsc-headers src/bun.js/bindings/headers.zig
touch src/bun.js/bindings/headers.zig
$(ZIG) build headers-obj
$(ZIG) build headers-obj $(ZIG_FLAGS)
$(CXX) $(PLATFORM_LINKER_FLAGS) $(JSC_FILES_DEBUG) ${ICU_FLAGS} $(DEBUG_IO_FILES) $(BUN_LLD_FLAGS_WITHOUT_JSC) -g $(DEBUG_BIN)/headers.o -W -o /tmp/build-jsc-headers -lc;
/tmp/build-jsc-headers
$(ZIG) translate-c src/bun.js/bindings/headers.h > src/bun.js/bindings/headers.zig
Expand Down Expand Up @@ -1681,7 +1682,7 @@ webcrypto:

sizegen:
mkdir -p $(BUN_TMP_DIR)
$(CXX) src/bun.js/headergen/sizegen.cpp -Wl,-dead_strip -Wl,-dead_strip_dylibs -fuse-ld=lld -o $(BUN_TMP_DIR)/sizegen $(CLANG_FLAGS) -O1
$(CXX) src/bun.js/headergen/sizegen.cpp -Wl,-dead_strip -Wl,-dead_strip_dylibs -fuse-ld=lld -o $(BUN_TMP_DIR)/sizegen $(CLANG_FLAGS) -O1
$(BUN_TMP_DIR)/sizegen > src/bun.js/bindings/sizes.zig


Expand Down
28 changes: 14 additions & 14 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ fn pkgPath(comptime out: []const u8) std.build.FileSource {
return .{ .path = outpath };
}
pub fn addPicoHTTP(step: *std.build.LibExeObjStep, comptime with_obj: bool) void {
step.addIncludeDir("src/deps");
step.addIncludePath("src/deps");

if (with_obj) {
step.addObjectFile("src/deps/picohttpparser.o");
}

step.addIncludeDir("src/deps");
step.addIncludePath("src/deps");

if (with_obj) {
step.addObjectFile(panicIfNotFound("src/deps/picohttpparser.o"));
Expand Down Expand Up @@ -187,7 +187,7 @@ const BunBuildOptions = struct {
var output_dir: []const u8 = "";
fn panicIfNotFound(comptime filepath: []const u8) []const u8 {
var file = std.fs.cwd().openFile(filepath, .{ .mode = .read_only }) catch |err| {
std.debug.panic("error: {s} opening {s}. Please ensure you've downloaded git submodules, and ran `make vendor`, `make jsc`.", .{ filepath, @errorName(err) });
std.debug.panic("error: {any} opening {any}. Please ensure you've downloaded git submodules, and ran `make vendor`, `make jsc`.", .{ filepath, @errorName(err) });
};
file.close();

Expand Down Expand Up @@ -274,7 +274,7 @@ pub fn build(b: *std.build.Builder) !void {
if (std.os.getenv("OUTPUT_DIR")) |output_dir_| {
output_dir = output_dir_;
} else {
const output_dir_base = try std.fmt.bufPrint(&output_dir_buf, "{s}{s}", .{ bin_label, triplet });
const output_dir_base = try std.fmt.bufPrint(&output_dir_buf, "{any}{any}", .{ bin_label, triplet });
output_dir = b.pathFromRoot(output_dir_base);
}

Expand Down Expand Up @@ -304,9 +304,9 @@ pub fn build(b: *std.build.Builder) !void {
else .{ .major = 0, .minor = 0, .patch = 0 };

// exe.want_lto = true;
defer b.default_step.dependOn(&b.addLog("Output: {s}/{s}\n", .{ output_dir, bun_executable_name }).step);
defer b.default_step.dependOn(&b.addLog("Output: {any}/{any}\n", .{ output_dir, bun_executable_name }).step);
defer b.default_step.dependOn(&b.addLog(
"Build {s} v{} - v{}\n",
"Build {any} v{} - v{}\n",
.{
triplet,
min_version,
Expand Down Expand Up @@ -377,7 +377,7 @@ pub fn build(b: *std.build.Builder) !void {

{
obj_step.dependOn(&b.addLog(
"Build {s} v{} - v{} ({s})\n",
"Build {any} v{} - v{} ({any})\n",
.{
triplet,
min_version,
Expand Down Expand Up @@ -415,7 +415,7 @@ pub fn build(b: *std.build.Builder) !void {
obj.link_function_sections = true;
}

var log_step = b.addLog("Destination: {s}/{s}\n", .{ output_dir, bun_executable_name });
var log_step = b.addLog("Destination: {any}/{any}\n", .{ output_dir, bun_executable_name });
log_step.step.dependOn(&obj.step);
}

Expand Down Expand Up @@ -515,7 +515,7 @@ pub fn build(b: *std.build.Builder) !void {
try linkObjectFiles(b, headers_obj, target);

{
var before = b.addLog("\x1b[" ++ color_map.get("magenta").? ++ "\x1b[" ++ color_map.get("b").? ++ "[{s} tests]" ++ "\x1b[" ++ color_map.get("d").? ++ " ----\n\n" ++ "\x1b[0m", .{"bun"});
var before = b.addLog("\x1b[" ++ color_map.get("magenta").? ++ "\x1b[" ++ color_map.get("b").? ++ "[{any} tests]" ++ "\x1b[" ++ color_map.get("d").? ++ " ----\n\n" ++ "\x1b[0m", .{"bun"});
var after = b.addLog("\x1b[" ++ color_map.get("d").? ++ "–––---\n\n" ++ "\x1b[0m", .{});
headers_step.dependOn(&before.step);
headers_step.dependOn(&headers_obj.step);
Expand All @@ -539,7 +539,7 @@ pub fn build(b: *std.build.Builder) !void {
try test_.packages.appendSlice(children);
}

var before = b.addLog("\x1b[" ++ color_map.get("magenta").? ++ "\x1b[" ++ color_map.get("b").? ++ "[{s} tests]" ++ "\x1b[" ++ color_map.get("d").? ++ " ----\n\n" ++ "\x1b[0m", .{pkg.name});
var before = b.addLog("\x1b[" ++ color_map.get("magenta").? ++ "\x1b[" ++ color_map.get("b").? ++ "[{any} tests]" ++ "\x1b[" ++ color_map.get("d").? ++ " ----\n\n" ++ "\x1b[0m", .{pkg.name});
var after = b.addLog("\x1b[" ++ color_map.get("d").? ++ "–––---\n\n" ++ "\x1b[0m", .{});
headers_step.dependOn(&before.step);
headers_step.dependOn(&test_.step);
Expand Down Expand Up @@ -593,13 +593,13 @@ pub fn linkObjectFiles(b: *std.build.Builder, obj: *std.build.LibExeObjStep, tar
});

for (dirs_to_search.slice()) |deps_path| {
var deps_dir = std.fs.cwd().openDir(deps_path, .{ .iterate = true }) catch continue;
var deps_dir = std.fs.cwd().openIterableDir(deps_path, .{}) catch continue;
var iterator = deps_dir.iterate();
obj.addIncludeDir(deps_path);
obj.addLibPath(deps_path);
obj.addIncludePath(deps_path);
obj.addLibraryPath(deps_path);

while (iterator.next() catch null) |entr| {
const entry: std.fs.Dir.Entry = entr;
const entry: std.fs.IterableDir.Entry = entr;
if (files_we_care_about.get(entry.name)) |obj_name| {
var has_added = try added.getOrPut(std.hash.Wyhash.hash(0, obj_name));
if (!has_added.found_existing) {
Expand Down
4 changes: 2 additions & 2 deletions misctools/fetch.zig
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ pub const Arguments = struct {
var absolute_path_ = file_path_buf[0..absolute_path_len :0];

var body_file = std.fs.openFileAbsoluteZ(absolute_path_, .{ .mode = .read_only }) catch |err| {
Output.printErrorln("<r><red>{s}<r> opening file {s}", .{ @errorName(err), absolute_path });
Output.printErrorln("<r><red>{any}<r> opening file {any}", .{ @errorName(err), absolute_path });
Global.exit(1);
};

var file_contents = body_file.readToEndAlloc(allocator, try body_file.getEndPos()) catch |err| {
Output.printErrorln("<r><red>{s}<r> reading file {s}", .{ @errorName(err), absolute_path });
Output.printErrorln("<r><red>{any}<r> reading file {any}", .{ @errorName(err), absolute_path });
Global.exit(1);
};
body_string = file_contents;
Expand Down
20 changes: 10 additions & 10 deletions misctools/http_bench.zig
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ pub const Arguments = struct {
var absolute_path_ = file_path_buf[0..absolute_path_len :0];

var body_file = std.fs.openFileAbsoluteZ(absolute_path_, .{ .mode = .read_only }) catch |err| {
Output.printErrorln("<r><red>{s}<r> opening file {s}", .{ @errorName(err), absolute_path });
Output.printErrorln("<r><red>{any}<r> opening file {any}", .{ @errorName(err), absolute_path });
Global.exit(1);
};

var file_contents = body_file.readToEndAlloc(allocator, try body_file.getEndPos()) catch |err| {
Output.printErrorln("<r><red>{s}<r> reading file {s}", .{ @errorName(err), absolute_path });
Output.printErrorln("<r><red>{any}<r> reading file {any}", .{ @errorName(err), absolute_path });
Global.exit(1);
};
body_string = file_contents;
Expand Down Expand Up @@ -166,11 +166,11 @@ pub const Arguments = struct {
.concurrency = std.fmt.parseInt(u16, args.option("--max-concurrency") orelse "32", 10) catch 32,
.turbo = args.flag("--turbo"),
.timeout = std.fmt.parseInt(usize, args.option("--timeout") orelse "0", 10) catch |err| {
Output.prettyErrorln("<r><red>{s}<r> parsing timeout", .{@errorName(err)});
Output.prettyErrorln("<r><red>{any}<r> parsing timeout", .{@errorName(err)});
Global.exit(1);
},
.count = std.fmt.parseInt(usize, args.option("--count") orelse "10", 10) catch |err| {
Output.prettyErrorln("<r><red>{s}<r> parsing count", .{@errorName(err)});
Output.prettyErrorln("<r><red>{any}<r> parsing count", .{@errorName(err)});
Global.exit(1);
},
};
Expand Down Expand Up @@ -252,8 +252,8 @@ pub fn main() anyerror!void {
fail_count += 1;
}

max_duration = @maximum(max_duration, http.elapsed);
min_duration = @minimum(min_duration, http.elapsed);
max_duration = @max(max_duration, http.elapsed);
min_duration = @min(min_duration, http.elapsed);

switch (resp.status_code) {
200, 202, 302 => {
Expand All @@ -265,26 +265,26 @@ pub fn main() anyerror!void {
}

if (http.gzip_elapsed > 0) {
Output.prettyError(" <d>{s}<r><d> - {s}<r> <d>({d} bytes, ", .{
Output.prettyError(" <d>{any}<r><d> - {any}<r> <d>({d} bytes, ", .{
@tagName(http.client.method),
http.client.url.href,
http.response_buffer.list.items.len,
});
Output.printElapsed(@floatCast(f64, @intToFloat(f128, http.gzip_elapsed) / std.time.ns_per_ms));
Output.prettyError("<d> gzip)<r>\n", .{});
} else {
Output.prettyError(" <d>{s}<r><d> - {s}<r> <d>({d} bytes)<r>\n", .{
Output.prettyError(" <d>{any}<r><d> - {any}<r> <d>({d} bytes)<r>\n", .{
@tagName(http.client.method),
http.client.url.href,
http.response_buffer.list.items.len,
});
}
} else if (http.err) |err| {
fail_count += 1;
Output.printError(" err: {s}\n", .{@errorName(err)});
Output.printError(" err: {any}\n", .{@errorName(err)});
} else {
fail_count += 1;
Output.prettyError(" Uh-oh: {s}\n", .{@tagName(http.state.loadUnchecked())});
Output.prettyError(" Uh-oh: {any}\n", .{@tagName(http.state.loadUnchecked())});
}

Output.flush();
Expand Down
4 changes: 2 additions & 2 deletions misctools/readlink-getfd.zig
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub fn main() anyerror!void {
var file = std.os.openZ(joined_z, O_PATH | std.os.O.CLOEXEC, 0) catch |err| {
switch (err) {
error.NotDir, error.FileNotFound => {
Output.prettyError("<r><red>404 Not Found<r>: <b>\"{s}\"<r>", .{joined_z});
Output.prettyError("<r><red>404 Not Found<r>: <b>\"{any}\"<r>", .{joined_z});
Global.exit(1);
},
else => {
Expand All @@ -62,5 +62,5 @@ pub fn main() anyerror!void {
file.close();
}

Output.print("{s}", .{path});
Output.print("{any}", .{path});
}
2 changes: 1 addition & 1 deletion misctools/readlink-realpath.zig
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ pub fn main() anyerror!void {
path = try std.os.realpathZ(to_resolve, &out_buffer);
}

Output.print("{s}", .{path});
Output.print("{any}", .{path});
}
2 changes: 1 addition & 1 deletion misctools/tgz.zig
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub fn main() anyerror!void {
};

const tarball_path = path_handler.joinAbsStringBuf(try std.process.getCwdAlloc(std.heap.c_allocator), &tarball_path_buf, &parts, .auto);
Output.prettyErrorln("Tarball Path: {s}", .{tarball_path});
Output.prettyErrorln("Tarball Path: {any}", .{tarball_path});
var folder = basename;

// var dir = try std.fs.cwd().makeOpenPath(folder, .{ .iterate = true });
Expand Down
4 changes: 2 additions & 2 deletions src/__global.zig
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ else
pub const package_json_version_with_sha = if (Environment.git_sha.len == 0)
package_json_version
else if (Environment.isDebug)
std.fmt.comptimePrint(BASE_VERSION ++ ".{d}_debug ({s})", .{ build_id, Environment.git_sha[0..@minimum(Environment.git_sha.len, 8)] })
std.fmt.comptimePrint(BASE_VERSION ++ ".{d}_debug ({s})", .{ build_id, Environment.git_sha[0..@min(Environment.git_sha.len, 8)] })
else
std.fmt.comptimePrint(BASE_VERSION ++ ".{d} ({s})", .{ build_id, Environment.git_sha[0..@minimum(Environment.git_sha.len, 8)] });
std.fmt.comptimePrint(BASE_VERSION ++ ".{d} ({s})", .{ build_id, Environment.git_sha[0..@min(Environment.git_sha.len, 8)] });

pub const os_name = if (Environment.isWindows)
"win32"
Expand Down
2 changes: 1 addition & 1 deletion src/analytics/analytics_schema.zig
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub const Reader = struct {
}

pub fn read(this: *Self, count: usize) ![]u8 {
const read_count = @minimum(count, this.remain.len);
const read_count = @min(count, this.remain.len);
if (read_count < count) {
return error.EOF;
}
Expand Down
2 changes: 1 addition & 1 deletion src/api/demo/schema.zig
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub const Reader = struct {
}

pub fn read(this: *Self, count: usize) ![]u8 {
const read_count = @minimum(count, this.remain.len);
const read_count = @min(count, this.remain.len);
if (read_count < count) {
return error.EOF;
}
Expand Down
2 changes: 1 addition & 1 deletion src/api/schema.zig
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub const Reader = struct {
}

pub fn read(this: *Self, count: usize) ![]u8 {
const read_count = @minimum(count, this.remain.len);
const read_count = @min(count, this.remain.len);
if (read_count < count) {
return error.EOF;
}
Expand Down
2 changes: 1 addition & 1 deletion src/baby_list.zig
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ const bun = @import("./global.zig");

// pub fn writeLatin1(this: *Delayer, list_: BabyList(u8), str: []const u8, allocator: std.mem.Allocator) !BabyList(u8) {
// var list = list_;
// log("writeLatin1({any}, {s})", .{ .delayer = this, .str = str });
// log("writeLatin1({any}, {any})", .{ .delayer = this, .str = str });

// {
// switch (this.last_encoding) {
Expand Down
12 changes: 6 additions & 6 deletions src/bench/string-handling.zig
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ pub fn main() anyerror!void {
}

if (index == std.math.maxInt(usize)) {
std.debug.print("manual [{d} byte file] {s} NOT found in {}\n", .{ contents.len, find, std.fmt.fmtDuration(timer.read()) });
std.debug.print("manual [{d} byte file] {any} NOT found in {}\n", .{ contents.len, find, std.fmt.fmtDuration(timer.read()) });
} else {
std.debug.print("manual [{d} byte file] {s} found at {d} in {}\n", .{ contents.len, find, index, std.fmt.fmtDuration(timer.read()) });
std.debug.print("manual [{d} byte file] {any} found at {d} in {}\n", .{ contents.len, find, index, std.fmt.fmtDuration(timer.read()) });
}
}

Expand All @@ -38,9 +38,9 @@ pub fn main() anyerror!void {
}

if (index == std.math.maxInt(usize)) {
std.debug.print("memcpy [{d} byte file] {s} NOT found in {}\n", .{ contents.len, find, std.fmt.fmtDuration(timer.read()) });
std.debug.print("memcpy [{d} byte file] {any} NOT found in {}\n", .{ contents.len, find, std.fmt.fmtDuration(timer.read()) });
} else {
std.debug.print("memcpy [{d} byte file] {s} found at {d} in {}\n", .{ contents.len, find, index, std.fmt.fmtDuration(timer.read()) });
std.debug.print("memcpy [{d} byte file] {any} found at {d} in {}\n", .{ contents.len, find, index, std.fmt.fmtDuration(timer.read()) });
}
}

Expand All @@ -56,9 +56,9 @@ pub fn main() anyerror!void {
}

if (index == std.math.maxInt(usize)) {
std.debug.print("ArrayList [{d} byte file] {s} NOT found in {}\n", .{ contents.len, find, std.fmt.fmtDuration(timer.read()) });
std.debug.print("ArrayList [{d} byte file] {any} NOT found in {}\n", .{ contents.len, find, std.fmt.fmtDuration(timer.read()) });
} else {
std.debug.print("ArrayList [{d} byte file] {s} found at {d} in {}\n", .{ contents.len, find, index, std.fmt.fmtDuration(timer.read()) });
std.debug.print("ArrayList [{d} byte file] {any} found at {d} in {}\n", .{ contents.len, find, index, std.fmt.fmtDuration(timer.read()) });
}
}
}
Loading