mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 23:58:50 +00:00
Fix printing IR of integer as a pointer with endianness.
When converting an integer value into a pointer and writing out the IR
for it in 'ir_print_exact_value', 'is_type_integer_endian_{little,big}'
did not correct handle being asked about pointer types.
They now reply with whether the endianness of 'uintptr' matches the
endianness being asked about.
This commit is contained in:
@@ -1041,6 +1041,8 @@ bool is_type_integer_endian_big(Type *t) {
|
|||||||
return build_context.endian_kind == TargetEndian_Big;
|
return build_context.endian_kind == TargetEndian_Big;
|
||||||
} else if (t->kind == Type_BitSet) {
|
} else if (t->kind == Type_BitSet) {
|
||||||
return is_type_integer_endian_big(bit_set_to_int(t));
|
return is_type_integer_endian_big(bit_set_to_int(t));
|
||||||
|
} else if (t->kind == Type_Pointer) {
|
||||||
|
return is_type_integer_endian_big(&basic_types[Basic_uintptr]);
|
||||||
} else {
|
} else {
|
||||||
GB_PANIC("Unsupported type: %s", type_to_string(t));
|
GB_PANIC("Unsupported type: %s", type_to_string(t));
|
||||||
}
|
}
|
||||||
@@ -1058,6 +1060,8 @@ bool is_type_integer_endian_little(Type *t) {
|
|||||||
return build_context.endian_kind == TargetEndian_Little;
|
return build_context.endian_kind == TargetEndian_Little;
|
||||||
} else if (t->kind == Type_BitSet) {
|
} else if (t->kind == Type_BitSet) {
|
||||||
return is_type_integer_endian_little(bit_set_to_int(t));
|
return is_type_integer_endian_little(bit_set_to_int(t));
|
||||||
|
} else if (t->kind == Type_Pointer) {
|
||||||
|
return is_type_integer_endian_little(&basic_types[Basic_uintptr]);
|
||||||
} else {
|
} else {
|
||||||
GB_PANIC("Unsupported type: %s", type_to_string(t));
|
GB_PANIC("Unsupported type: %s", type_to_string(t));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user