authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-10-17 03:10:57+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-10-17 05:24:52+02:00
log36fe31458189eff70e47f963e0bc6bf6d0883202
treebb38bdfb8a18253730c7bfe081febc3f5a2b5dc2
parent00780901379b8b51082a98249baede0b8357f4a4
signature Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.Target: simplify freestanding prong in cTypeBitSize() a bit


1 files changed, 7 insertions(+), 27 deletions(-)

lib/std/Target.zig+7-27
......@@ -3254,30 +3254,6 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) ?u16 {
32543254 .long, .ulong, .float => 32,
32553255 .double, .longdouble, .longlong, .ulonglong => 64,
32563256 },
3257 .mips64,
3258 .mips64el,
3259 => switch (c_type) {
3260 .char => 8,
3261 .short, .ushort => 16,
3262 .int, .uint, .float => 32,
3263 .long, .ulong => switch (target.abi) {
3264 .abin32 => 32,
3265 else => 64,
3266 },
3267 .longlong, .ulonglong, .double => 64,
3268 .longdouble => 128,
3269 },
3270 .x86_64 => switch (c_type) {
3271 .char => 8,
3272 .short, .ushort => 16,
3273 .int, .uint, .float => 32,
3274 .long, .ulong => switch (target.abi) {
3275 .x32 => 32,
3276 else => 64,
3277 },
3278 .longlong, .ulonglong, .double => 64,
3279 .longdouble => 80,
3280 },
32813257 else => switch (c_type) {
32823258 .char => 8,
32833259 .short, .ushort => 16,
......@@ -3285,7 +3261,11 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) ?u16 {
32853261 .long, .ulong => target.ptrBitWidth(),
32863262 .longlong, .ulonglong, .double => 64,
32873263 .longdouble => switch (target.cpu.arch) {
3288 .x86 => 80,
3264 else => 64,
3265
3266 .x86,
3267 .x86_64,
3268 => 80,
32893269
32903270 .alpha,
32913271 .riscv32,
......@@ -3294,6 +3274,8 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) ?u16 {
32943274 .riscv64be,
32953275 .aarch64,
32963276 .aarch64_be,
3277 .mips64,
3278 .mips64el,
32973279 .powerpc,
32983280 .powerpcle,
32993281 .powerpc64,
......@@ -3307,8 +3289,6 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) ?u16 {
33073289 .loongarch64,
33083290 .ve,
33093291 => 128,
3310
3311 else => 64,
33123292 },
33133293 },
33143294 },