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
signature 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 @@...@@ -3,6 +3,8 @@
3// This file is part of [zig](https://ziglang.org/), which is MIT licensed.3// This file is part of [zig](https://ziglang.org/), which is MIT licensed.
4// The MIT license requires this copyright notice to be included in all copies4// The MIT license requires this copyright notice to be included in all copies
5// and substantial portions of the software.5// and substantial portions of the software.
6const std = @import("../std.zig");
7
6/// A protocol is an interface identified by a GUID.8/// A protocol is an interface identified by a GUID.
7pub const protocols = @import("uefi/protocols.zig");9pub const protocols = @import("uefi/protocols.zig");
810
...@@ -33,10 +35,10 @@ pub const Guid = extern struct {...@@ -33,10 +35,10 @@ pub const Guid = extern struct {
33 self: @This(),35 self: @This(),
34 comptime f: []const u8,36 comptime f: []const u8,
35 options: std.fmt.FormatOptions,37 options: std.fmt.FormatOptions,
36 out_stream: anytype,38 writer: anytype,
37 ) Errors!void {39 ) !void {
38 if (f.len == 0) {40 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}", .{
40 self.time_low,42 self.time_low,
41 self.time_mid,43 self.time_mid,
42 self.time_high_and_version,44 self.time_high_and_version,
...@@ -48,6 +50,15 @@ pub const Guid = extern struct {...@@ -48,6 +50,15 @@ pub const Guid = extern struct {
48 @compileError("Unknown format character: '" ++ f ++ "'");50 @compileError("Unknown format character: '" ++ f ++ "'");
49 }51 }
50 }52 }
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 }
51};62};
5263
53/// An EFI Handle represents a collection of related interfaces.64/// An EFI Handle represents a collection of related interfaces.