diff options
Diffstat (limited to 'tools/d2c')
-rw-r--r-- | tools/d2c/bits.c | 24 |
1 files changed, 23 insertions, 1 deletions
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; |