commit 88f476590cbe5690e26bd135f2f4021e49ca36e9
parent db3880b41ff8390890021b7f6a39d24f2594c497
Author: Virgil Dupras <hsoft@hardcoded.net>
Date: Tue, 29 Nov 2022 13:24:31 -0500
ar/puff: fix porting mistake
I removed a type-casting that was actually important.
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/fs/ar/puff.c b/fs/ar/puff.c
@@ -76,6 +76,7 @@ struct state {
static int bits(state *s, int need)
{
int val; /* bit accumulator (can use up to 20 bits) */
+ int x; // temporary crutch
/* load at least need bits into val */
val = s->bitbuf;
@@ -84,7 +85,10 @@ static int bits(state *s, int need)
fputs("out of input\n", ConsoleOut());
abort();
}
- val |= (s->in[s->incnt++]) << s->bitcnt; /* load eight bits */
+ // TODO: implement typecasting. this should work:
+ // val |= (int)(s->in[s->incnt++]) << s->bitcnt;
+ x = s->in[s->incnt++];
+ val |= x << s->bitcnt; /* load eight bits */
s->bitcnt += 8;
}