feature. See also
. The project being documented here (as the example) is the Zig library itself.
target.intAlignment
pub fn intAlignment(target: *const std.Target, bits: u16) u16
File
Code
pub fn intAlignment(target: *const std.Target, bits: u16) u16 {
return switch (target.cpu.arch) {
.x86 => switch (bits) {
0...8 => 1,
9...16 => 2,
17...32 => 4,
33...64 => switch (target.os.tag) {
.uefi, .windows => 8,
else => 4,
},
else => 16,
},
.x86_64 => switch (bits) {
0...8 => 1,
9...16 => 2,
17...32 => 4,
33...64 => 8,
else => 16,
},
else => switch (bits) {
0 => 1,
else => @min(
std.math.ceilPowerOfTwoPromote(u16, @intCast((@as(u17, bits) + 7) / 8)),
target.cMaxIntAlignment(),
),
},
};
}