diff --git a/programs/test_slow_decompression.c b/programs/test_slow_decompression.c index 4890453..7726224 100644 --- a/programs/test_slow_decompression.c +++ b/programs/test_slow_decompression.c @@ -7,28 +7,6 @@ #include "test_util.h" -struct output_bitstream { - unsigned long bitbuf; - int bitcount; - u8 *next; - u8 *end; -}; - -static bool -put_bits(struct output_bitstream *os, unsigned long bits, int num_bits) -{ - os->bitbuf |= bits << os->bitcount; - os->bitcount += num_bits; - while (os->bitcount >= 8) { - if (os->next == os->end) - return false; - *os->next++ = os->bitbuf; - os->bitcount -= 8; - os->bitbuf >>= 8; - } - return true; -} - /* * Generate a DEFLATE stream containing all empty "static Huffman" blocks. * diff --git a/programs/test_util.c b/programs/test_util.c index cadff14..189035d 100644 --- a/programs/test_util.c +++ b/programs/test_util.c @@ -202,3 +202,18 @@ u64 timer_KB_per_s(u64 bytes, u64 ticks) { return bytes * timer_frequency() / ticks / 1000; } + +bool +put_bits(struct output_bitstream *os, machine_word_t bits, int num_bits) +{ + os->bitbuf |= bits << os->bitcount; + os->bitcount += num_bits; + while (os->bitcount >= 8) { + if (os->next == os->end) + return false; + *os->next++ = os->bitbuf; + os->bitcount -= 8; + os->bitbuf >>= 8; + } + return true; +} diff --git a/programs/test_util.h b/programs/test_util.h index c6a12f6..bbdc546 100644 --- a/programs/test_util.h +++ b/programs/test_util.h @@ -52,4 +52,14 @@ extern u64 timer_ticks_to_ms(u64 ticks); extern u64 timer_MB_per_s(u64 bytes, u64 ticks); extern u64 timer_KB_per_s(u64 bytes, u64 ticks); +struct output_bitstream { + machine_word_t bitbuf; + int bitcount; + u8 *next; + u8 *end; +}; + +extern bool put_bits(struct output_bitstream *os, machine_word_t bits, + int num_bits); + #endif /* PROGRAMS_TEST_UTIL_H */