zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 914acf13cba7adc4e55734d85f60ab09e7fdf8ac (tree)
parent feb05a716d1ae105cf0e8f9966b6ade7f32dc680
Author: GasInfinity <me@gasinfinity.dev>
Date:   Mon, 27 Oct 2025 11:13:25 +0100

chore: make `std.zig.target.intByteSize` return an `u16`

Diffstat:
Mlib/std/zig/target.zig | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/std/zig/target.zig b/lib/std/zig/target.zig @@ -472,8 +472,9 @@ fn eqlIgnoreCase(ignore_case: bool, a: []const u8, b: []const u8) bool { } } -pub fn intByteSize(target: *const std.Target, bits: u16) u19 { - return std.mem.alignForward(u19, @intCast((@as(u17, bits) + 7) / 8), intAlignment(target, bits)); +pub fn intByteSize(target: *const std.Target, bits: u16) u16 { + const previous_aligned = std.mem.alignBackward(u16, bits, 8); + return std.mem.alignForward(u16, @divExact(previous_aligned, 8) + @intFromBool(previous_aligned != bits), intAlignment(target, bits)); } pub fn intAlignment(target: *const std.Target, bits: u16) u16 {