mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
std.os.uefi.Guid fixes (#8032)
* uefi: Guid.format compiles again Also use "writer" nomenclature in argument name. * uefi: add Guid.eql
This commit is contained in:
parent
cc5e5cca83
commit
4272f07f66
@ -3,6 +3,8 @@
|
||||
// This file is part of [zig](https://ziglang.org/), which is MIT licensed.
|
||||
// The MIT license requires this copyright notice to be included in all copies
|
||||
// and substantial portions of the software.
|
||||
const std = @import("../std.zig");
|
||||
|
||||
/// A protocol is an interface identified by a GUID.
|
||||
pub const protocols = @import("uefi/protocols.zig");
|
||||
|
||||
@ -33,10 +35,10 @@ pub const Guid = extern struct {
|
||||
self: @This(),
|
||||
comptime f: []const u8,
|
||||
options: std.fmt.FormatOptions,
|
||||
out_stream: anytype,
|
||||
) Errors!void {
|
||||
writer: anytype,
|
||||
) !void {
|
||||
if (f.len == 0) {
|
||||
return std.fmt.format(out_stream, "{x:0>8}-{x:0>4}-{x:0>4}-{x:0>2}{x:0>2}-{x:0>12}", .{
|
||||
return std.fmt.format(writer, "{x:0>8}-{x:0>4}-{x:0>4}-{x:0>2}{x:0>2}-{x:0>12}", .{
|
||||
self.time_low,
|
||||
self.time_mid,
|
||||
self.time_high_and_version,
|
||||
@ -48,6 +50,15 @@ pub const Guid = extern struct {
|
||||
@compileError("Unknown format character: '" ++ f ++ "'");
|
||||
}
|
||||
}
|
||||
|
||||
pub fn eql(a: std.os.uefi.Guid, b: std.os.uefi.Guid) bool {
|
||||
return a.time_low == b.time_low and
|
||||
a.time_mid == b.time_mid and
|
||||
a.time_high_and_version == b.time_high_and_version and
|
||||
a.clock_seq_high_and_reserved == b.clock_seq_high_and_reserved and
|
||||
a.clock_seq_low == b.clock_seq_low and
|
||||
std.mem.eql(u8, &a.node, &b.node);
|
||||
}
|
||||
};
|
||||
|
||||
/// An EFI Handle represents a collection of related interfaces.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user