diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | tools/d2c/bits.c | 24 |
2 files changed, 28 insertions, 1 deletions
@@ -1,5 +1,10 @@ 14-12-02 Cyrille Bagard <nocbos@gmail.com> + * tools/d2c/bits.c: + Fix sign extensions when building 32-bit mask code from bit field. + +14-12-02 Cyrille Bagard <nocbos@gmail.com> + * src/arch/arm/v7/opdefs/Makefile.am: Distinguish Thumb 16 and Thumb 32. Add 'mov_A88102.d' to ARMV7_DEFS. diff --git a/tools/d2c/bits.c b/tools/d2c/bits.c index 32c3fd9..4169acf 100644 --- a/tools/d2c/bits.c +++ b/tools/d2c/bits.c @@ -324,7 +324,29 @@ bool declare_used_bits_fields(const coding_bits *bits, int fd, unsigned int wide bool check_bits_correctness(const coding_bits *bits, int fd) { - dprintf(fd, "\t\tif ((raw & 0x%" PRIx64 ") != 0x%" PRIx64 ") return NULL;\n", bits->mask, bits->bits); + switch (bits->curpos) + { + case 8: + dprintf(fd, "\t\tif ((raw & 0x%" PRIx8 ") != 0x%" PRIx8 ") return NULL;\n", + (uint8_t)bits->mask, (uint8_t)bits->bits); + break; + + case 16: + dprintf(fd, "\t\tif ((raw & 0x%" PRIx16 ") != 0x%" PRIx16 ") return NULL;\n", + (uint16_t)bits->mask, (uint16_t)bits->bits); + break; + + case 32: + dprintf(fd, "\t\tif ((raw & 0x%" PRIx32 ") != 0x%" PRIx32 ") return NULL;\n", + (uint32_t)bits->mask, (uint32_t)bits->bits); + break; + + case 64: + dprintf(fd, "\t\tif ((raw & 0x%" PRIx64 ") != 0x%" PRIx64 ") return NULL;\n", + bits->mask, bits->bits); + break; + + } return true; |