diff options
| author | gingerBill <bill@gingerbill.org> | 2018-06-15 21:46:03 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2018-06-15 21:46:03 +0100 |
| commit | ba67e474d3ab48cf15916892a15759f50930f72f (patch) | |
| tree | ed91e7aaa72fb5b194455c5cbea4ace27a99c65d /src | |
| parent | b92a8c513ea04ce2c4e6245d047d47ece0b75fa2 (diff) | |
Make source code compile with 32 bit (but not build 32 bit code)
Diffstat (limited to 'src')
| -rw-r--r-- | src/build_settings.cpp | 2 | ||||
| -rw-r--r-- | src/check_type.cpp | 2 | ||||
| -rw-r--r-- | src/ir.cpp | 18 | ||||
| -rw-r--r-- | src/types.cpp | 8 |
4 files changed, 14 insertions, 16 deletions
diff --git a/src/build_settings.cpp b/src/build_settings.cpp index 0dddbc8f2..5b3d846cb 100644 --- a/src/build_settings.cpp +++ b/src/build_settings.cpp @@ -528,8 +528,6 @@ void init_build_context(void) { bc->opt_flags = str_lit(" "); - - gbString llc_flags = gb_string_make_reserve(heap_allocator(), 64); if (bc->ODIN_DEBUG) { llc_flags = gb_string_appendc(llc_flags, "-debug-compile "); diff --git a/src/check_type.cpp b/src/check_type.cpp index fc43077b2..7751dca59 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -137,7 +137,7 @@ bool check_custom_align(CheckerContext *ctx, AstNode *node, i64 *align_) { if (is_type_untyped(type) || is_type_integer(type)) { if (o.value.kind == ExactValue_Integer) { i64 align = o.value.value_integer; - if (align < 1 || !gb_is_power_of_two(align)) { + if (align < 1 || !gb_is_power_of_two(cast(isize)align)) { error(node, "#align must be a power of 2, got %lld", align); return false; } diff --git a/src/ir.cpp b/src/ir.cpp index e60de290b..359fcc144 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -3332,7 +3332,7 @@ irValue *ir_emit_conv(irProcedure *proc, irValue *value, Type *t) { Type *elem = dst->Array.elem; irValue *e = ir_emit_conv(proc, value, elem); irValue *v = ir_add_local_generated(proc, t); - isize index_count = dst->Array.count; + isize index_count = cast(isize)dst->Array.count; for (i32 i = 0; i < index_count; i++) { irValue *elem = ir_emit_array_epi(proc, v, i); @@ -5222,13 +5222,13 @@ irValue *ir_build_expr_internal(irProcedure *proc, AstNode *expr) { } } - i64 param_count = 0; + isize param_count = 0; if (pt->params) { GB_ASSERT(pt->params->kind == Type_Tuple); param_count = pt->params->Tuple.variables.count; } - auto args = array_make<irValue *>(proc->module->allocator, gb_max(param_count, arg_count)); + auto args = array_make<irValue *>(proc->module->allocator, cast(isize)gb_max(param_count, arg_count)); isize variadic_index = pt->variadic_index; bool variadic = pt->variadic && variadic_index >= 0; bool vari_expand = ce->ellipsis.pos.line != 0; @@ -5272,7 +5272,7 @@ irValue *ir_build_expr_internal(irProcedure *proc, AstNode *expr) { GB_ASSERT(param_count < 1000000); if (arg_count < param_count) { - isize end = param_count; + isize end = cast(isize)param_count; if (variadic) { end = variadic_index; } @@ -5328,7 +5328,7 @@ irValue *ir_build_expr_internal(irProcedure *proc, AstNode *expr) { } } } else { - for (i64 i = 0; i < param_count; i++) { + for (isize i = 0; i < param_count; i++) { Entity *e = param_tuple->variables[i]; if (e->kind == Entity_Variable) { GB_ASSERT(args[i] != nullptr); @@ -5376,7 +5376,7 @@ irValue *ir_build_expr_internal(irProcedure *proc, AstNode *expr) { } } - i64 final_count = param_count; + isize final_count = param_count; if (is_c_vararg) { final_count = arg_count; } @@ -7993,7 +7993,7 @@ void ir_setup_type_info_data(irProcedure *proc) { // NOTE(bill): Setup type_info irValue *gep = ir_get_type_info_ptr(proc, t->Array.elem); ir_emit_store(proc, ir_emit_struct_ep(proc, tag, 0), gep); - isize ez = type_size_of(t->Array.elem); + i64 ez = type_size_of(t->Array.elem); irValue *elem_size = ir_emit_struct_ep(proc, tag, 1); ir_emit_store(proc, elem_size, ir_const_int(a, ez)); @@ -8008,7 +8008,7 @@ void ir_setup_type_info_data(irProcedure *proc) { // NOTE(bill): Setup type_info irValue *gep = ir_get_type_info_ptr(proc, t->DynamicArray.elem); ir_emit_store(proc, ir_emit_struct_ep(proc, tag, 0), gep); - isize ez = type_size_of(t->DynamicArray.elem); + i64 ez = type_size_of(t->DynamicArray.elem); irValue *elem_size = ir_emit_struct_ep(proc, tag, 1); ir_emit_store(proc, elem_size, ir_const_int(a, ez)); break; @@ -8019,7 +8019,7 @@ void ir_setup_type_info_data(irProcedure *proc) { // NOTE(bill): Setup type_info irValue *gep = ir_get_type_info_ptr(proc, t->Slice.elem); ir_emit_store(proc, ir_emit_struct_ep(proc, tag, 0), gep); - isize ez = type_size_of(t->Slice.elem); + i64 ez = type_size_of(t->Slice.elem); irValue *elem_size = ir_emit_struct_ep(proc, tag, 1); ir_emit_store(proc, elem_size, ir_const_int(a, ez)); break; diff --git a/src/types.cpp b/src/types.cpp index a57058dbf..3921d5fa5 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -1601,7 +1601,7 @@ Selection lookup_field_from_index(Type *type, i64 index) { case Type_BitField: { auto sel_array = array_make<i32>(a, 1); sel_array[0] = cast(i32)index; - return make_selection(type->BitField.fields[index], sel_array, false); + return make_selection(type->BitField.fields[cast(isize)index], sel_array, false); } break; } @@ -2163,7 +2163,7 @@ i64 type_size_of_internal(Type *t, TypePath *path) { } align = type_align_of_internal(t, path); type_set_offsets(t); - size = t->Tuple.offsets[count-1] + type_size_of_internal(t->Tuple.variables[count-1]->type, path); + size = t->Tuple.offsets[cast(isize)count-1] + type_size_of_internal(t->Tuple.variables[cast(isize)count-1]->type, path); return align_formula(size, align); } break; @@ -2233,7 +2233,7 @@ i64 type_size_of_internal(Type *t, TypePath *path) { return FAILURE_SIZE; } type_set_offsets(t); - size = t->Struct.offsets[count-1] + type_size_of_internal(t->Struct.fields[count-1]->type, path); + size = t->Struct.offsets[cast(isize)count-1] + type_size_of_internal(t->Struct.fields[cast(isize)count-1]->type, path); return align_formula(size, align); } } break; @@ -2243,7 +2243,7 @@ i64 type_size_of_internal(Type *t, TypePath *path) { i64 end = 0; if (t->BitField.fields.count > 0) { i64 last = t->BitField.fields.count-1; - end = t->BitField.offsets[last] + t->BitField.sizes[last]; + end = t->BitField.offsets[cast(isize)last] + t->BitField.sizes[cast(isize)last]; } i64 bits = align_formula(end, align); GB_ASSERT((bits%8) == 0); |