big endian bool cmp

This commit is contained in:
kalsprite
2026-08-24 18:15:01 -07:00
parent 3e159a4e10
commit c3bfbea235
4 changed files with 46 additions and 0 deletions

View File

@@ -2407,6 +2407,13 @@ gb_internal lbValue lb_emit_conv(lbProcedure *p, lbValue value, Type *t) {
// boolean -> boolean/integer
if (is_type_boolean(src) && (is_type_boolean(dst) || is_type_integer(dst))) {
LLVMValueRef b = LLVMBuildICmp(p->builder, LLVMIntNE, value.value, LLVMConstNull(lb_type(m, value.type)), "");
if (type_size_of(default_type(dst)) > 1 && is_type_different_to_arch_endianness(dst)) {
Type *platform_dst_type = integer_endian_type_to_platform_type(dst);
lbValue res = {};
res.value = LLVMBuildIntCast2(p->builder, b, lb_type(m, platform_dst_type), false, "");
res.type = t;
return lb_emit_byte_swap(p, res, t);
}
lbValue res = {};
res.value = LLVMBuildIntCast2(p->builder, b, lb_type(m, t), false, "");
res.type = t;