summaryrefslogtreecommitdiffhomepage
path: root/ir/tv
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2014-12-30 02:16:58 +0100
committerMatthias Braun <matze@braunis.de>2014-12-30 11:09:07 +0100
commit1cf9a9fd980f883987b53341ca3669ccff9f8e85 (patch)
tree9146d13a8d1229f63f75caecd52997dc4b96f53c /ir/tv
parente1c31f87063a8eafc0a3a44e3fc09f7c19ac4e66 (diff)
strcalc: cleanup and fix print_buf for mode_size%8 != 0
Diffstat (limited to 'ir/tv')
-rw-r--r--ir/tv/strcalc.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/ir/tv/strcalc.c b/ir/tv/strcalc.c
index 2949dbc..b5b652b 100644
--- a/ir/tv/strcalc.c
+++ b/ir/tv/strcalc.c
@@ -707,16 +707,17 @@ char *sc_print_buf(char *buf, size_t buf_len, const sc_word *value,
assert(SC_BITS == 8);
unsigned counter = 0;
for ( ; counter < n_full_words; ++counter) {
- *(--pos) = digits[(value[counter] >> 0) & 0xf];
- *(--pos) = digits[(value[counter] >> 4) & 0xf];
+ sc_word x = value[counter];
+ *(--pos) = digits[(x >> 0) & 0xf];
+ *(--pos) = digits[(x >> 4) & 0xf];
}
/* last nibble must be masked */
if (remaining_bits != 0) {
sc_word mask = max_digit(remaining_bits);
sc_word x = value[counter++] & mask;
- *(--pos) = digits[(value[x] >> 0) & 0xf];
- *(--pos) = digits[(value[x] >> 4) & 0xf];
+ *(--pos) = digits[(x >> 0) & 0xf];
+ *(--pos) = digits[(x >> 4) & 0xf];
assert(pos >= buf);
}