authorgravatar for 1915+kivikakk@users.noreply.github.comAsherah Connor <1915+kivikakk@users.noreply.github.com> 2021-02-21 21:17:59+11:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2021-02-21 12:17:59+02:00
log4272f07f668979bc356f117cdf12986a95402b43
treed1346c4496d1bef7846ec56857101568fb0f2168
parentcc5e5cca83cca9a1de81f98a333e8a3fcd26df0c
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

std.os.uefi.Guid fixes (#8032)

* uefi: Guid.format compiles again Also use "writer" nomenclature in argument name. * uefi: add Guid.eql

1 files changed, 14 insertions(+), 3 deletions(-)

lib/std/os/uefi.zig+14-3
......@@ -3,6 +3,8 @@
33// This file is part of [zig](https://ziglang.org/), which is MIT licensed.
44// The MIT license requires this copyright notice to be included in all copies
55// and substantial portions of the software.
6const std = @import("../std.zig");
7
68/// A protocol is an interface identified by a GUID.
79pub const protocols = @import("uefi/protocols.zig");
810
......@@ -33,10 +35,10 @@ pub const Guid = extern struct {
3335 self: @This(),
3436 comptime f: []const u8,
3537 options: std.fmt.FormatOptions,
36 out_stream: anytype,
37 ) Errors!void {
38 writer: anytype,
39 ) !void {
3840 if (f.len == 0) {
39 return std.fmt.format(out_stream, "{x:0>8}-{x:0>4}-{x:0>4}-{x:0>2}{x:0>2}-{x:0>12}", .{
41 return std.fmt.format(writer, "{x:0>8}-{x:0>4}-{x:0>4}-{x:0>2}{x:0>2}-{x:0>12}", .{
4042 self.time_low,
4143 self.time_mid,
4244 self.time_high_and_version,
......@@ -48,6 +50,15 @@ pub const Guid = extern struct {
4850 @compileError("Unknown format character: '" ++ f ++ "'");
4951 }
5052 }
53
54 pub fn eql(a: std.os.uefi.Guid, b: std.os.uefi.Guid) bool {
55 return a.time_low == b.time_low and
56 a.time_mid == b.time_mid and
57 a.time_high_and_version == b.time_high_and_version and
58 a.clock_seq_high_and_reserved == b.clock_seq_high_and_reserved and
59 a.clock_seq_low == b.clock_seq_low and
60 std.mem.eql(u8, &a.node, &b.node);
61 }
5162};
5263
5364/// An EFI Handle represents a collection of related interfaces.