From c4d638581aa4a9cfa4b622ce8547b6fc98896bd1 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Fri, 13 Oct 2023 17:27:31 +0200 Subject: store 64-bit signed int after 1111 --- mico-dump.c | 9 +++++++-- mico-store.c | 5 +++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/mico-dump.c b/mico-dump.c index 982c1b4..ce13a3e 100644 --- a/mico-dump.c +++ b/mico-dump.c @@ -61,7 +61,7 @@ getsigned(struct bitreader *input, int count) return bits; } -static int32_t +static int64_t get1(struct bitreader *input) { if (getbits1_msb(input, 1) == 0) @@ -72,7 +72,12 @@ get1(struct bitreader *input) return getsigned(input, 9); if (getbits1_msb(input, 1) == 0) return getsigned(input, 12); - return getsigned(input, 32); + + int64_t v = getsigned(input, 32); + v <<= 32; + v |= getbits1_msb(input, 32); + + return v; } int diff --git a/mico-store.c b/mico-store.c index 6fe025a..f2dd221 100644 --- a/mico-store.c +++ b/mico-store.c @@ -78,7 +78,7 @@ putsigned(struct bitfile *bf, int count, int v) } void -put1(struct bitfile *bf, int v) +put1(struct bitfile *bf, int64_t v) { if (v == 0) { putbits1_msb(bf, 1, 0x0); @@ -101,7 +101,8 @@ put1(struct bitfile *bf, int v) } putbits1_msb(bf, 4, 0xf); - putsigned(bf, 32, v); + putsigned(bf, 32, v >> 32); + putbits1_msb(bf, 32, v & 0xffffffff); } -- cgit 1.4.1