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 04:29:45+02:00
loge4069c6c5f8dc084dd64de5023ed8e95e34badab
tree6b6daba2deb4d58983d2ea35baa7277dca0350eb
parent5e124ec7236a3318dac7d557a7acf31ad8471b75
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
......@@ -3242,30 +3242,6 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) ?u16 {
32423242 .long, .ulong, .float => 32,
32433243 .double, .longdouble, .longlong, .ulonglong => 64,
32443244 },
3245 .mips64,
3246 .mips64el,
3247 => switch (c_type) {
3248 .char => 8,
3249 .short, .ushort => 16,
3250 .int, .uint, .float => 32,
3251 .long, .ulong => switch (target.abi) {
3252 .abin32 => 32,
3253 else => 64,
3254 },
3255 .longlong, .ulonglong, .double => 64,
3256 .longdouble => 128,
3257 },
3258 .x86_64 => switch (c_type) {
3259 .char => 8,
3260 .short, .ushort => 16,
3261 .int, .uint, .float => 32,
3262 .long, .ulong => switch (target.abi) {
3263 .x32 => 32,
3264 else => 64,
3265 },
3266 .longlong, .ulonglong, .double => 64,
3267 .longdouble => 80,
3268 },
32693245 else => switch (c_type) {
32703246 .char => 8,
32713247 .short, .ushort => 16,
......@@ -3273,7 +3249,11 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) ?u16 {
32733249 .long, .ulong => target.ptrBitWidth(),
32743250 .longlong, .ulonglong, .double => 64,
32753251 .longdouble => switch (target.cpu.arch) {
3276 .x86 => 80,
3252 else => 64,
3253
3254 .x86,
3255 .x86_64,
3256 => 80,
32773257
32783258 .alpha,
32793259 .riscv32,
......@@ -3282,6 +3262,8 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) ?u16 {
32823262 .riscv64be,
32833263 .aarch64,
32843264 .aarch64_be,
3265 .mips64,
3266 .mips64el,
32853267 .powerpc,
32863268 .powerpcle,
32873269 .powerpc64,
......@@ -3295,8 +3277,6 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) ?u16 {
32953277 .loongarch64,
32963278 .ve,
32973279 => 128,
3298
3299 else => 64,
33003280 },
33013281 },
33023282 },