diff --git a/lib/std/math/math.matrix.c3 b/lib/std/math/math.matrix.c3 index d79de3f52..e495eef93 100644 --- a/lib/std/math/math.matrix.c3 +++ b/lib/std/math/math.matrix.c3 @@ -74,7 +74,7 @@ fn Matrix2x2 Matrix2x2.mul(Matrix2x2* a, Matrix2x2 b) { return Matrix2x2 { a.m00 * b.m00 + a.m01 * b.m10, a.m00 * b.m01 + a.m01 * b.m11, - a.m10 * b.m01 + a.m11 * b.m11, a.m10 * b.m01 + a.m11 * b.m11, + a.m10 * b.m00 + a.m11 * b.m10, a.m10 * b.m01 + a.m11 * b.m11, }; } diff --git a/src/compiler/llvm_codegen_expr.c b/src/compiler/llvm_codegen_expr.c index a22f5a0d7..598bcea64 100644 --- a/src/compiler/llvm_codegen_expr.c +++ b/src/compiler/llvm_codegen_expr.c @@ -1720,15 +1720,6 @@ static inline void llvm_emit_initialize_reference_list(GenContext *c, BEValue *r llvm_value_addr(c, ref); LLVMValueRef value = ref->value; - - // If this is a union, we assume it's initializing the first element. - if (real_type->type_kind == TYPE_UNION) - { - assert(vec_size(elements) == 1); - real_type = type_lowering(real_type->decl->strukt.members[0]->type); - ref->type = real_type; - } - LLVMTypeRef llvm_type = llvm_get_type(c, real_type); bool is_struct = type_is_union_or_strukt(real_type); bool is_array = real_type->type_kind == TYPE_ARRAY; diff --git a/src/compiler/sema_casts.c b/src/compiler/sema_casts.c index 885e4fabd..734e2ad6b 100644 --- a/src/compiler/sema_casts.c +++ b/src/compiler/sema_casts.c @@ -25,6 +25,10 @@ static bool pointer_to_pointer(Expr* expr, Type *type); static bool bool_to_int(Expr *expr, Type *canonical, Type *type); static bool bool_to_float(Expr *expr, Type *canonical, Type *type); static bool integer_to_bool(Expr *expr, Type *type); +static bool float_to_bool(Expr *expr, Type *type); +static bool float_to_float(Expr* expr, Type *canonical, Type *type); +static bool float_to_integer(Expr *expr, Type *canonical, Type *type); + static bool voidfail_to_error(Expr *expr, Type *type); static void const_int_to_fp_cast(Expr *expr, Type *canonical, Type *type); INLINE bool insert_runtime_cast_unless_const(Expr *expr, CastKind kind, Type *type); @@ -262,7 +266,7 @@ static bool integer_to_bool(Expr *expr, Type *type) * Cast any float to bool using CAST_FPBOOL * or rewrite 0.0 => false, any other value => true */ -bool float_to_bool(Expr *expr, Type *type) +static bool float_to_bool(Expr *expr, Type *type) { if (insert_runtime_cast_unless_const(expr, CAST_FPBOOL, type)) return true; @@ -288,9 +292,10 @@ static bool float_to_float(Expr* expr, Type *canonical, Type *type) } /** - * Convert from any floating point to int + * Convert from any floating point to int using CAST_FPSI / CAST_FPUI + * Const conversion will disable narrowable and hex. */ -bool float_to_integer(Expr *expr, Type *canonical, Type *type) +static bool float_to_integer(Expr *expr, Type *canonical, Type *type) { bool is_signed = type_is_signed(canonical); if (insert_runtime_cast_unless_const(expr, is_signed ? CAST_FPSI : CAST_FPUI, type)) return true; diff --git a/src/version.h b/src/version.h index 71dfa4064..4e45f8d41 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define COMPILER_VERSION "0.4.87" \ No newline at end of file +#define COMPILER_VERSION "0.4.88" \ No newline at end of file