day 20
[advent21.git] / 16b.c
diff --git a/16b.c b/16b.c
index 6c93a16..9b5f3e1 100644 (file)
--- a/16b.c
+++ b/16b.c
@@ -13,10 +13,9 @@ struct stream { int pos; char *buf; };
 
 int next(struct stream *f)
 {
-       int r;
        if (*f->buf == '\0')
-               f->buf = hex2bin[r];
-       r =*(f->buf++) == '1' ? 1 : 0;
+               f->buf = hex2bin[getchar()];
+       int r = *(f->buf++) == '1' ? 1 : 0;
        f->pos++;
        return r;
 }