Type: adjust C type sizes

This commit is contained in:
Veikka Tuominen 2022-08-04 11:37:09 +03:00 committed by Andrew Kelley
parent 94662591d6
commit bd21f499dc
2 changed files with 41 additions and 28 deletions

View File

@ -1750,10 +1750,11 @@ pub const Target = struct {
else => false,
},
f64 => switch (target.cpu.arch) {
.aarch64 => target.isDarwin(),
.x86_64,
.i386,
.riscv64,
.aarch64,
.aarch64_be,
.aarch64_32,
.s390x,

View File

@ -6530,6 +6530,11 @@ pub const CType = enum {
.long, .ulong => return 32,
.longlong, .ulonglong, .longdouble => return 64,
},
.avr => switch (self) {
.short, .ushort, .int, .uint => return 16,
.long, .ulong, .longdouble => return 32,
.longlong, .ulonglong => return 64,
},
else => switch (self) {
.short, .ushort => return 16,
.int, .uint => return 32,
@ -6568,31 +6573,42 @@ pub const CType = enum {
.emscripten,
.plan9,
.solaris,
=> switch (self) {
.short, .ushort => return 16,
.int, .uint => return 32,
.long, .ulong => return target.cpu.arch.ptrBitWidth(),
.longlong, .ulonglong => return 64,
.longdouble => switch (target.cpu.arch) {
.i386, .x86_64 => return 80,
.haiku,
.ananas,
.fuchsia,
.minix,
=> switch (target.cpu.arch) {
.avr => switch (self) {
.short, .ushort, .int, .uint => return 16,
.long, .ulong, .longdouble => return 32,
.longlong, .ulonglong => return 64,
},
else => switch (self) {
.short, .ushort => return 16,
.int, .uint => return 32,
.long, .ulong => return target.cpu.arch.ptrBitWidth(),
.longlong, .ulonglong => return 64,
.longdouble => switch (target.cpu.arch) {
.i386, .x86_64 => return 80,
.riscv64,
.aarch64,
.aarch64_be,
.aarch64_32,
.s390x,
.mips64,
.mips64el,
.sparc,
.sparc64,
.sparcel,
.powerpc,
.powerpcle,
.powerpc64,
.powerpc64le,
=> return 128,
.riscv64,
.aarch64,
.aarch64_be,
.aarch64_32,
.s390x,
.mips64,
.mips64el,
.sparc,
.sparc64,
.sparcel,
.powerpc,
.powerpcle,
.powerpc64,
.powerpc64le,
=> return 128,
else => return 64,
else => return 64,
},
},
},
@ -6612,14 +6628,10 @@ pub const CType = enum {
},
},
.ananas,
.cloudabi,
.fuchsia,
.kfreebsd,
.lv2,
.zos,
.haiku,
.minix,
.rtems,
.nacl,
.aix,