aboutsummaryrefslogtreecommitdiff
path: root/c/enc/write_bits.h
diff options
context:
space:
mode:
Diffstat (limited to 'c/enc/write_bits.h')
-rw-r--r--c/enc/write_bits.h19
1 files changed, 6 insertions, 13 deletions
diff --git a/c/enc/write_bits.h b/c/enc/write_bits.h
index 83fdddc..efa66f8 100644
--- a/c/enc/write_bits.h
+++ b/c/enc/write_bits.h
@@ -9,11 +9,8 @@
#ifndef BROTLI_ENC_WRITE_BITS_H_
#define BROTLI_ENC_WRITE_BITS_H_
-#include <assert.h>
-#include <stdio.h> /* printf */
-
+#include "../common/platform.h"
#include <brotli/types.h>
-#include "./port.h"
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
@@ -48,11 +45,9 @@ static BROTLI_INLINE void BrotliWriteBits(size_t n_bits,
access a byte that was never initialized). */
uint8_t *p = &array[*pos >> 3];
uint64_t v = *p;
-#ifdef BIT_WRITER_DEBUG
- printf("WriteBits %2d 0x%016llx %10d\n", n_bits, bits, *pos);
-#endif
- assert((bits >> n_bits) == 0);
- assert(n_bits <= 56);
+ BROTLI_LOG(("WriteBits %2d 0x%016llx %10d\n", n_bits, bits, *pos));
+ BROTLI_DCHECK((bits >> n_bits) == 0);
+ BROTLI_DCHECK(n_bits <= 56);
v |= bits << (*pos & 7);
BROTLI_UNALIGNED_STORE64LE(p, v); /* Set some bits. */
*pos += n_bits;
@@ -76,10 +71,8 @@ static BROTLI_INLINE void BrotliWriteBits(size_t n_bits,
static BROTLI_INLINE void BrotliWriteBitsPrepareStorage(
size_t pos, uint8_t *array) {
-#ifdef BIT_WRITER_DEBUG
- printf("WriteBitsPrepareStorage %10d\n", pos);
-#endif
- assert((pos & 7) == 0);
+ BROTLI_LOG(("WriteBitsPrepareStorage %10d\n", pos));
+ BROTLI_DCHECK((pos & 7) == 0);
array[pos >> 3] = 0;
}