From 4e3f6de027b5b4cb88d0ac83b05db083e9f0ce9e Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 12 Feb 2016 12:07:11 -0700 Subject: c integer size takes into account architecture and OS --- src/codegen.cpp | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) (limited to 'src/codegen.cpp') diff --git a/src/codegen.cpp b/src/codegen.cpp index 2579092567..bf208a527b 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -3195,27 +3195,6 @@ static const CIntTypeInfo c_int_type_infos[] = { {CIntTypeULongLong, "c_ulonglong", false}, }; -static int get_c_type_size_in_bits(CodeGen *g, CIntType id) { - // TODO other architectures besides x86_64 - // other operating systems besides linux - switch (id) { - case CIntTypeShort: - case CIntTypeUShort: - return 16; - case CIntTypeInt: - case CIntTypeUInt: - return 32; - case CIntTypeLong: - case CIntTypeULong: - case CIntTypeLongLong: - case CIntTypeULongLong: - return 64; - case CIntTypeCount: - zig_unreachable(); - } - zig_unreachable(); -} - static void define_builtin_types(CodeGen *g) { { // if this type is anywhere in the AST, we should never hit codegen. @@ -3288,7 +3267,7 @@ static void define_builtin_types(CodeGen *g) { for (int i = 0; i < array_length(c_int_type_infos); i += 1) { const CIntTypeInfo *info = &c_int_type_infos[i]; - uint64_t size_in_bits = get_c_type_size_in_bits(g, info->id); + uint64_t size_in_bits = get_c_type_size_in_bits(&g->zig_target, info->id); bool is_signed = info->is_signed; TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdInt); -- cgit v1.2.3