Signedness of type when translated to Zig.
Different from QualType.signedness() for char and enums.
Returns null for non-int types.
fn signedness(t: *Translator, qt: QualType) ?std.builtin.Signedness
fn signedness(t: *Translator, qt: QualType) ?std.builtin.Signedness {
return loop: switch (qt.base(t.comp).type) {
.bool => .unsigned,
.bit_int => |bit_int| bit_int.signedness,
.int => |int_ty| switch (int_ty) {
.char => .unsigned, // Always translated as u8
.schar, .short, .int, .long, .long_long, .int128 => .signed,
.uchar, .ushort, .uint, .ulong, .ulong_long, .uint128 => .unsigned,
},
.@"enum" => |enum_ty| {
const tag_qt = enum_ty.tag orelse return .signed;
continue :loop tag_qt.base(t.comp).type;
},
else => return null,
};
}