From 0fae31fb545b474359359fd644911fa335c5c282 Mon Sep 17 00:00:00 2001 From: Ginger Bill Date: Mon, 31 Jul 2017 11:36:00 +0100 Subject: Extra type safety; Fix typos --- src/ssa.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/ssa.cpp') diff --git a/src/ssa.cpp b/src/ssa.cpp index 94ee4f15e..b3681b3ed 100644 --- a/src/ssa.cpp +++ b/src/ssa.cpp @@ -1640,18 +1640,18 @@ ssaValue *ssa_build_expr(ssaProc *p, AstNode *expr) { i64 s = 8*type_size_of(p->allocator, t); switch (s) { - case 8: return ssa_const_i8 (p, tv.type, i128_to_i64(tv.value.value_integer)); - case 16: return ssa_const_i16(p, tv.type, i128_to_i64(tv.value.value_integer)); - case 32: return ssa_const_i32(p, tv.type, i128_to_i64(tv.value.value_integer)); - case 64: return ssa_const_i64(p, tv.type, i128_to_i64(tv.value.value_integer)); + case 8: return ssa_const_i8 (p, tv.type, cast (i8)i128_to_i64(tv.value.value_integer)); + case 16: return ssa_const_i16(p, tv.type, cast(i16)i128_to_i64(tv.value.value_integer)); + case 32: return ssa_const_i32(p, tv.type, cast(i32)i128_to_i64(tv.value.value_integer)); + case 64: return ssa_const_i64(p, tv.type, cast(i64)i128_to_i64(tv.value.value_integer)); default: GB_PANIC("Unknown integer size"); } } else if (is_type_float(t)) { GB_ASSERT(tv.value.kind == ExactValue_Float); i64 s = 8*type_size_of(p->allocator, t); switch (s) { - case 32: return ssa_const_f32(p, tv.type, tv.value.value_float); - case 64: return ssa_const_f64(p, tv.type, tv.value.value_float); + case 32: return ssa_const_f32(p, tv.type, cast(f32)tv.value.value_float); + case 64: return ssa_const_f64(p, tv.type, cast(f64)tv.value.value_float); default: GB_PANIC("Unknown float size"); } } -- cgit v1.2.3