| author | |
| committer | |
| log | e33d27927b95fe7e6c27db4b0960c28df31250ac |
| tree | cebb7a98c0e1113c43e72c43e71b3d2512924ae5 |
| parent | d05d189fe2710c39746dc1ecbe3010c615f58b92 |
1 files changed, 7 insertions(+), 0 deletions(-)
src/lib.zig+7| ... | ... | @@ -523,3 +523,10 @@ pub fn parse_int(comptime T: type, s: ?string, b: u8, d: T) T { |
| 523 | 523 | pub fn parse_bool(s: ?string) bool { |
| 524 | 524 | return parse_int(u1, s, 10, 0) > 0; |
| 525 | 525 | } |
| 526 | ||
| 527 | pub fn to_hex(array: anytype) [array.len * 2]u8 { | |
| 528 | var res: [array.len * 2]u8 = undefined; | |
| 529 | var fbs = std.io.fixedBufferStream(&res); | |
| 530 | std.fmt.format(fbs.writer(), "{x}", .{std.fmt.fmtSliceHexLower(&array)}) catch unreachable; | |
| 531 | return res; | |
| 532 | } |