| ... | ... | @@ -2,7 +2,17 @@ const std = @import("std"); |
| 2 | 2 | const string = []const u8; |
| 3 | 3 | const assert = std.debug.assert; |
| 4 | 4 | |
| 5 | | pub const range = @import("range").range; |
| 5 | /// Use this as a way to increment an index using a for loop. Works with both |
| 6 | /// runtime and comptime integers. |
| 7 | /// |
| 8 | /// ```zig |
| 9 | /// for (range(10)) |_, i| { |
| 10 | /// // 'i' will increment from 0 -> 9 |
| 11 | /// } |
| 12 | /// ``` |
| 13 | pub fn range(len: usize) []const void { |
| 14 | return @as([*]void, undefined)[0..len]; |
| 15 | } |
| 6 | 16 | |
| 7 | 17 | pub fn fmtByteCountIEC(alloc: std.mem.Allocator, b: u64) !string { |
| 8 | 18 | return try reduceNumber(alloc, b, 1024, "B", "KMGTPEZYRQ"); |