| ... | @@ -2216,7 +2216,8 @@ pub const Type = struct { | ... | @@ -2216,7 +2216,8 @@ pub const Type = struct { |
| 2216 | /// Returns true if and only if the type is a fixed-width, signed integer. | 2216 | /// Returns true if and only if the type is a fixed-width, signed integer. |
| 2217 | pub fn isSignedInt(ty: Type, mod: *const Module) bool { | 2217 | pub fn isSignedInt(ty: Type, mod: *const Module) bool { |
| 2218 | return switch (ty.toIntern()) { | 2218 | return switch (ty.toIntern()) { |
| 2219 | .c_char_type, .isize_type, .c_short_type, .c_int_type, .c_long_type, .c_longlong_type => true, | 2219 | .c_char_type => mod.getTarget().charSignedness() == .signed, |
| | 2220 | .isize_type, .c_short_type, .c_int_type, .c_long_type, .c_longlong_type => true, |
| 2220 | else => switch (mod.intern_pool.indexToKey(ty.toIntern())) { | 2221 | else => switch (mod.intern_pool.indexToKey(ty.toIntern())) { |
| 2221 | .int_type => |int_type| int_type.signedness == .signed, | 2222 | .int_type => |int_type| int_type.signedness == .signed, |
| 2222 | else => false, | 2223 | else => false, |
| ... | @@ -2227,6 +2228,7 @@ pub const Type = struct { | ... | @@ -2227,6 +2228,7 @@ pub const Type = struct { |
| 2227 | /// Returns true if and only if the type is a fixed-width, unsigned integer. | 2228 | /// Returns true if and only if the type is a fixed-width, unsigned integer. |
| 2228 | pub fn isUnsignedInt(ty: Type, mod: *const Module) bool { | 2229 | pub fn isUnsignedInt(ty: Type, mod: *const Module) bool { |
| 2229 | return switch (ty.toIntern()) { | 2230 | return switch (ty.toIntern()) { |
| | 2231 | .c_char_type => mod.getTarget().charSignedness() == .unsigned, |
| 2230 | .usize_type, .c_ushort_type, .c_uint_type, .c_ulong_type, .c_ulonglong_type => true, | 2232 | .usize_type, .c_ushort_type, .c_uint_type, .c_ulong_type, .c_ulonglong_type => true, |
| 2231 | else => switch (mod.intern_pool.indexToKey(ty.toIntern())) { | 2233 | else => switch (mod.intern_pool.indexToKey(ty.toIntern())) { |
| 2232 | .int_type => |int_type| int_type.signedness == .unsigned, | 2234 | .int_type => |int_type| int_type.signedness == .unsigned, |
| ... | @@ -2257,7 +2259,7 @@ pub const Type = struct { | ... | @@ -2257,7 +2259,7 @@ pub const Type = struct { |
| 2257 | }, | 2259 | }, |
| 2258 | .usize_type => return .{ .signedness = .unsigned, .bits = target.ptrBitWidth() }, | 2260 | .usize_type => return .{ .signedness = .unsigned, .bits = target.ptrBitWidth() }, |
| 2259 | .isize_type => return .{ .signedness = .signed, .bits = target.ptrBitWidth() }, | 2261 | .isize_type => return .{ .signedness = .signed, .bits = target.ptrBitWidth() }, |
| 2260 | .c_char_type => return .{ .signedness = .signed, .bits = target.c_type_bit_size(.char) }, | 2262 | .c_char_type => return .{ .signedness = mod.getTarget().charSignedness(), .bits = target.c_type_bit_size(.char) }, |
| 2261 | .c_short_type => return .{ .signedness = .signed, .bits = target.c_type_bit_size(.short) }, | 2263 | .c_short_type => return .{ .signedness = .signed, .bits = target.c_type_bit_size(.short) }, |
| 2262 | .c_ushort_type => return .{ .signedness = .unsigned, .bits = target.c_type_bit_size(.ushort) }, | 2264 | .c_ushort_type => return .{ .signedness = .unsigned, .bits = target.c_type_bit_size(.ushort) }, |
| 2263 | .c_int_type => return .{ .signedness = .signed, .bits = target.c_type_bit_size(.int) }, | 2265 | .c_int_type => return .{ .signedness = .signed, .bits = target.c_type_bit_size(.int) }, |