Zig 0.17.0-dev (Split by item) 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.
std › zig › llvm › Builder › Type › alignment Public Function alignment Doc Source Public Function std.zig.llvm.Builder.Type.alignment
pub fn alignment (ty : Type , kind : enum Params ty : Type kind : enum { abi , pref } builder : *const Builder File zig/llvm/Builder.zig: 1705
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742 pub fn alignment (ty : Type , kind : enum { abi , pref }, builder : *const Builder ) Alignment {
const item = builder .type_items .items [@backingInt (ty )];
switch (item .tag ) {
else => unreachable ,
.simple => switch (@as (Simple , @fromBackingInt (@intCast (item .data )))) {
else => unreachable ,
.label => {
const spec = builder .data_layout .getPointerSpec (.default );
return switch (kind ) {
.abi => spec .flags .abi_align ,
.pref => spec .flags .pref_align ,
};
},
.half , .bfloat , .float , .double , .ppc_fp128 , .fp128 , .x86_fp80 => {
const spec = builder .data_layout .getFloatSpec (@intCast (ty .bits (builder ).fixed ));
return switch (kind ) {
.abi => spec .abi_align ,
.pref => spec .pref_align ,
};
},
.x86_amx => return comptime .fromByteUnits (64 ),
},
.integer => {
const spec = builder .data_layout .getIntegerSpec (@intCast (item .data ));
return switch (kind ) {
.abi => spec .abi_align ,
.pref => spec .pref_align ,
};
},
.pointer => {
const spec = builder .data_layout .getPointerSpec (@fromBackingInt (@intCast (item .data )));
return switch (kind ) {
.abi => spec .flags .abi_align ,
.pref => spec .flags .pref_align ,
};
},
}
}