forked from M-Labs/nac3
nac3core: distinguish i64 and i32 in bool conversion
This commit is contained in:
parent
a91b2d602c
commit
1e6848ab92
|
@ -414,7 +414,14 @@ impl TopLevelComposer {
|
||||||
let arg = args[0].1;
|
let arg = args[0].1;
|
||||||
if ctx.unifier.unioned(arg_ty, boolean) {
|
if ctx.unifier.unioned(arg_ty, boolean) {
|
||||||
Some(arg)
|
Some(arg)
|
||||||
} else if ctx.unifier.unioned(arg_ty, int32) || ctx.unifier.unioned(arg_ty, int64) {
|
} else if ctx.unifier.unioned(arg_ty, int32) {
|
||||||
|
Some(ctx.builder.build_int_compare(
|
||||||
|
IntPredicate::NE,
|
||||||
|
ctx.ctx.i32_type().const_zero(),
|
||||||
|
arg.into_int_value(),
|
||||||
|
"bool",
|
||||||
|
).into())
|
||||||
|
} else if ctx.unifier.unioned(arg_ty, int64) {
|
||||||
Some(ctx.builder.build_int_compare(
|
Some(ctx.builder.build_int_compare(
|
||||||
IntPredicate::NE,
|
IntPredicate::NE,
|
||||||
ctx.ctx.i64_type().const_zero(),
|
ctx.ctx.i64_type().const_zero(),
|
||||||
|
|
Loading…
Reference in New Issue