From 8ec57a7281eea35a9a623bed868f89c53fc89ac1 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Wed, 15 Jan 2020 17:29:01 +0100 Subject: [PATCH] clear bit first in pushBit so we don't need initialized buff --- armsrc/lfsampling.c | 1 + 1 file changed, 1 insertion(+) diff --git a/armsrc/lfsampling.c b/armsrc/lfsampling.c index 290542959..f694b01f4 100644 --- a/armsrc/lfsampling.c +++ b/armsrc/lfsampling.c @@ -93,6 +93,7 @@ sample_config *getSamplingConfig() { void pushBit(BitstreamOut *stream, uint8_t bit) { int bytepos = stream->position >> 3; // divide by 8 int bitpos = stream->position & 7; + *(stream->buffer + bytepos) &= ~(1 << (7 - bitpos)); *(stream->buffer + bytepos) |= (bit > 0) << (7 - bitpos); stream->position++; stream->numbits++;