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 {...@@ -3254,30 +3254,6 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) ?u16 {
3254 .long, .ulong, .float => 32,3254 .long, .ulong, .float => 32,
3255 .double, .longdouble, .longlong, .ulonglong => 64,3255 .double, .longdouble, .longlong, .ulonglong => 64,
3256 },3256 },
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 },
3281 else => switch (c_type) {3257 else => switch (c_type) {
3282 .char => 8,3258 .char => 8,
3283 .short, .ushort => 16,3259 .short, .ushort => 16,
...@@ -3285,7 +3261,11 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) ?u16 {...@@ -3285,7 +3261,11 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) ?u16 {
3285 .long, .ulong => target.ptrBitWidth(),3261 .long, .ulong => target.ptrBitWidth(),
3286 .longlong, .ulonglong, .double => 64,3262 .longlong, .ulonglong, .double => 64,
3287 .longdouble => switch (target.cpu.arch) {3263 .longdouble => switch (target.cpu.arch) {
3288 .x86 => 80,3264 else => 64,
3265
3266 .x86,
3267 .x86_64,
3268 => 80,
32893269
3290 .alpha,3270 .alpha,
3291 .riscv32,3271 .riscv32,
...@@ -3294,6 +3274,8 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) ?u16 {...@@ -3294,6 +3274,8 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) ?u16 {
3294 .riscv64be,3274 .riscv64be,
3295 .aarch64,3275 .aarch64,
3296 .aarch64_be,3276 .aarch64_be,
3277 .mips64,
3278 .mips64el,
3297 .powerpc,3279 .powerpc,
3298 .powerpcle,3280 .powerpcle,
3299 .powerpc64,3281 .powerpc64,
...@@ -3307,8 +3289,6 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) ?u16 {...@@ -3307,8 +3289,6 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) ?u16 {
3307 .loongarch64,3289 .loongarch64,
3308 .ve,3290 .ve,
3309 => 128,3291 => 128,
3310
3311 else => 64,
3312 },3292 },
3313 },3293 },
3314 },3294 },