11const std = @import ("std" );
2+ const print = @import ("../../include/zig/print.zig" );
23const builtin = @import ("builtin" );
34const math = std .math ;
45const Allocator = std .mem .Allocator ;
@@ -14,7 +15,7 @@ pub fn main() !void {
1415 const stretch_depth = max_depth + 1 ;
1516 const stretch_tree = Node .make (stretch_depth , global_allocator ).? ;
1617 defer stretch_tree .deinit ();
17- try printFmt ("stretch tree of depth {d}\t check: {d}\n " , .{ stretch_depth , stretch_tree .check () });
18+ try print . printFmt ("stretch tree of depth {d}\t check: {d}\n " , .{ stretch_depth , stretch_tree .check () });
1819 }
1920 const long_lived_tree = Node .make (max_depth , global_allocator ).? ;
2021 defer long_lived_tree .deinit ();
@@ -29,10 +30,10 @@ pub fn main() !void {
2930 defer tree .deinit ();
3031 sum += tree .check ();
3132 }
32- try printFmt ("{d}\t trees of depth {d}\t check: {d}\n " , .{ iterations , depth , sum });
33+ try print . printFmt ("{d}\t trees of depth {d}\t check: {d}\n " , .{ iterations , depth , sum });
3334 }
3435
35- try printFmt ("long lived tree of depth {d}\t check: {d}\n " , .{ max_depth , long_lived_tree .check () });
36+ try print . printFmt ("long lived tree of depth {d}\t check: {d}\n " , .{ max_depth , long_lived_tree .check () });
3637}
3738
3839fn get_n () ! usize {
@@ -42,12 +43,6 @@ fn get_n() !usize {
4243 return @as (usize , @intCast (try std .fmt .parseInt (u32 , arg , 10 )));
4344}
4445
45- fn printFmt (comptime fmt : []const u8 , args : anytype ) ! void {
46- var buf : [256 ]u8 = undefined ;
47- const out = try std .fmt .bufPrint (& buf , fmt , args );
48- _ = try std .posix .write (std .posix .STDOUT_FILENO , out );
49- }
50-
5146const Node = struct {
5247 const Self = @This ();
5348
0 commit comments