stage2: implement inttype ZIR

also add i128 and u128 to const inst list
This commit is contained in:
Andrew Kelley
2021-03-23 16:12:26 -07:00
parent aa46a705ad
commit be673e6793
5 changed files with 94 additions and 9 deletions

View File

@@ -3599,11 +3599,14 @@ pub fn lookupDeclName(mod: *Module, scope: *Scope, ident_name: []const u8) ?*Dec
return mod.decl_table.get(name_hash);
}
pub fn makeIntType(arena: *Allocator, signed: bool, bits: u16) !Type {
pub fn makeIntType(arena: *Allocator, signedness: std.builtin.Signedness, bits: u16) !Type {
const int_payload = try arena.create(Type.Payload.Bits);
int_payload.* = .{
.base = .{
.tag = if (signed) .int_signed else .int_unsigned,
.tag = switch (signedness) {
.signed => .int_signed,
.unsigned => .int_unsigned,
},
},
.data = bits,
};