Skip to content

Commit bd21f49

Browse files
Vexuandrewrk
authored andcommitted
Type: adjust C type sizes
1 parent 9466259 commit bd21f49

File tree

2 files changed

+41
-28
lines changed

2 files changed

+41
-28
lines changed

lib/std/target.zig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1750,10 +1750,11 @@ pub const Target = struct {
17501750
else => false,
17511751
},
17521752
f64 => switch (target.cpu.arch) {
1753+
.aarch64 => target.isDarwin(),
1754+
17531755
.x86_64,
17541756
.i386,
17551757
.riscv64,
1756-
.aarch64,
17571758
.aarch64_be,
17581759
.aarch64_32,
17591760
.s390x,

src/type.zig

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6530,6 +6530,11 @@ pub const CType = enum {
65306530
.long, .ulong => return 32,
65316531
.longlong, .ulonglong, .longdouble => return 64,
65326532
},
6533+
.avr => switch (self) {
6534+
.short, .ushort, .int, .uint => return 16,
6535+
.long, .ulong, .longdouble => return 32,
6536+
.longlong, .ulonglong => return 64,
6537+
},
65336538
else => switch (self) {
65346539
.short, .ushort => return 16,
65356540
.int, .uint => return 32,
@@ -6568,31 +6573,42 @@ pub const CType = enum {
65686573
.emscripten,
65696574
.plan9,
65706575
.solaris,
6571-
=> switch (self) {
6572-
.short, .ushort => return 16,
6573-
.int, .uint => return 32,
6574-
.long, .ulong => return target.cpu.arch.ptrBitWidth(),
6575-
.longlong, .ulonglong => return 64,
6576-
.longdouble => switch (target.cpu.arch) {
6577-
.i386, .x86_64 => return 80,
6576+
.haiku,
6577+
.ananas,
6578+
.fuchsia,
6579+
.minix,
6580+
=> switch (target.cpu.arch) {
6581+
.avr => switch (self) {
6582+
.short, .ushort, .int, .uint => return 16,
6583+
.long, .ulong, .longdouble => return 32,
6584+
.longlong, .ulonglong => return 64,
6585+
},
6586+
else => switch (self) {
6587+
.short, .ushort => return 16,
6588+
.int, .uint => return 32,
6589+
.long, .ulong => return target.cpu.arch.ptrBitWidth(),
6590+
.longlong, .ulonglong => return 64,
6591+
.longdouble => switch (target.cpu.arch) {
6592+
.i386, .x86_64 => return 80,
65786593

6579-
.riscv64,
6580-
.aarch64,
6581-
.aarch64_be,
6582-
.aarch64_32,
6583-
.s390x,
6584-
.mips64,
6585-
.mips64el,
6586-
.sparc,
6587-
.sparc64,
6588-
.sparcel,
6589-
.powerpc,
6590-
.powerpcle,
6591-
.powerpc64,
6592-
.powerpc64le,
6593-
=> return 128,
6594+
.riscv64,
6595+
.aarch64,
6596+
.aarch64_be,
6597+
.aarch64_32,
6598+
.s390x,
6599+
.mips64,
6600+
.mips64el,
6601+
.sparc,
6602+
.sparc64,
6603+
.sparcel,
6604+
.powerpc,
6605+
.powerpcle,
6606+
.powerpc64,
6607+
.powerpc64le,
6608+
=> return 128,
65946609

6595-
else => return 64,
6610+
else => return 64,
6611+
},
65966612
},
65976613
},
65986614

@@ -6612,14 +6628,10 @@ pub const CType = enum {
66126628
},
66136629
},
66146630

6615-
.ananas,
66166631
.cloudabi,
6617-
.fuchsia,
66186632
.kfreebsd,
66196633
.lv2,
66206634
.zos,
6621-
.haiku,
6622-
.minix,
66236635
.rtems,
66246636
.nacl,
66256637
.aix,

0 commit comments

Comments
 (0)