summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2023-10-13 17:27:31 +0200
committerLeah Neukirchen <leah@vuxu.org>2023-10-13 17:27:31 +0200
commitc4d638581aa4a9cfa4b622ce8547b6fc98896bd1 (patch)
tree772f60f3a10f63a59854c2099013325dd78ea092
parent7f7cfbbead307c4d522af19bfdcfdd58edc98458 (diff)
downloadmico-c4d638581aa4a9cfa4b622ce8547b6fc98896bd1.tar.gz
mico-c4d638581aa4a9cfa4b622ce8547b6fc98896bd1.tar.xz
mico-c4d638581aa4a9cfa4b622ce8547b6fc98896bd1.zip
store 64-bit signed int after 1111
-rw-r--r--mico-dump.c9
-rw-r--r--mico-store.c5
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);
 }