diff options
| author | gingerBill <bill@gingerbill.org> | 2018-12-02 19:27:42 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2018-12-02 19:27:42 +0000 |
| commit | 17b0e3a1a1017a3f2afc8fd47fc7451d65eb33cd (patch) | |
| tree | f028923c2bb40dbcc7b22eb1327b0446fe28686e /src/ir_print.cpp | |
| parent | 28583bfff88ff1378a0e71030701071dcfd37462 (diff) | |
Fix bit sets with custom endian underlying type
Diffstat (limited to 'src/ir_print.cpp')
| -rw-r--r-- | src/ir_print.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ir_print.cpp b/src/ir_print.cpp index 298e722e2..2536679d0 100644 --- a/src/ir_print.cpp +++ b/src/ir_print.cpp @@ -890,6 +890,14 @@ void ir_print_exact_value(irFileBuffer *f, irModule *m, ExactValue value, Type * i64 lower = type->BitSet.lower; bits |= 1ull<<cast(u64)(v-lower); } + if (is_type_different_to_arch_endianness(type)) { + i64 size = type_size_of(type); + switch (size) { + case 2: bits = cast(u64)gb_endian_swap16(cast(u16)bits); break; + case 4: bits = cast(u64)gb_endian_swap32(cast(u32)bits); break; + case 8: bits = cast(u64)gb_endian_swap64(cast(u64)bits); break; + } + } ir_write_u64(f, bits); } else { ir_write_str_lit(f, "zeroinitializer"); |