Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Enum

Align

Public Enum
std.coff.SectionHeader.Flags.Align
pub const Align = enum(u4)

Functions

pub fn toByteUnits(a: Align) ?u16
pub fn fromByteUnits(n: u16) Align
pub fn alignment(a: Align) ?std.mem.Alignment

File

coff.zig:638
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
        pub const Align = enum(u4) {
            NONE = 0,
            @"1BYTES" = 1,
            @"2BYTES" = 2,
            @"4BYTES" = 3,
            @"8BYTES" = 4,
            @"16BYTES" = 5,
            @"32BYTES" = 6,
            @"64BYTES" = 7,
            @"128BYTES" = 8,
            @"256BYTES" = 9,
            @"512BYTES" = 10,
            @"1024BYTES" = 11,
            @"2048BYTES" = 12,
            @"4096BYTES" = 13,
            @"8192BYTES" = 14,
            _,

            pub fn toByteUnits(a: Align) ?u16 {
                if (a == .NONE) return null;
                return @as(u16, 1) << (@backingInt(a) - 1);
            }

            pub fn fromByteUnits(n: u16) Align {
                std.debug.assert(std.math.isPowerOfTwo(n));
                return @fromBackingInt(@intCast(@ctz(n) + 1));
            }

            pub fn alignment(a: Align) ?std.mem.Alignment {
                return .fromByteUnitsOptional(a.toByteUnits() orelse null);
            }
        }