AC_DEFINE([ENABLE_ASSERTIONS], [1], [Define to 1 if including assertions.])
fi
-AC_MSG_CHECKING([whether to include more assertions])
-AC_ARG_ENABLE([more-assertions],
- AS_HELP_STRING([--enable-more-assertions], [include even more assertions]),
- [ENABLE_MORE_ASSERTIONS=$enableval],
- [ENABLE_MORE_ASSERTIONS=no]
- )
-AC_MSG_RESULT([$ENABLE_MORE_ASSERTIONS])
-if test "x$ENABLE_MORE_ASSERTIONS" = "xyes"; then
- AC_DEFINE([ENABLE_MORE_ASSERTIONS], [1], [Define to 1 if including more assertions.])
-fi
-
-
AC_MSG_CHECKING([whether to include automatic compression verification])
AC_ARG_ENABLE([verify_compression],
AS_HELP_STRING([--enable-verify-compression], [always
# define wimlib_assert(expr)
#endif
-#ifdef ENABLE_MORE_ASSERTIONS
-# define wimlib_assert2(expr) wimlib_assert(expr)
-#else
-# define wimlib_assert2(expr)
-#endif
-
#endif /* _WIMLIB_ASSERT_H */
bitstream_ensure_bits(struct input_bitstream *is, const unsigned num_bits)
{
/* This currently works for at most 17 bits. */
- wimlib_assert2(num_bits <= 17);
if (is->bitsleft >= num_bits)
return;
# define WARNING_WITH_ERRNO(format, ...) dummy_tprintf(T(format), ## __VA_ARGS__)
#endif /* !ENABLE_ERROR_MESSAGES */
-#if defined(ENABLE_MORE_ASSERTIONS) && !defined(ENABLE_ASSERTIONS)
-# define ENABLE_ASSERTIONS 1
-#endif
-
-
#ifdef ENABLE_DEBUG
extern void
wimlib_debug(const tchar *file, int line, const char *func,
u32 *A = codewords;
unsigned num_used_syms;
- /* Assumptions */
- wimlib_assert2(num_syms >= 2);
- wimlib_assert2(num_syms <= (1 << NUM_SYMBOL_BITS));
- wimlib_assert2((1ULL << max_codeword_len) >= num_syms);
- wimlib_assert2(max_codeword_len <= 32);
-
/* We begin by sorting the symbols primarily by frequency and
* secondarily by symbol value. As an optimization, the array
* used for this purpose ('A') shares storage with the space in
const unsigned entries_per_xmm = sizeof(__m128i) / sizeof(decode_table[0]);
#endif
- /* Check parameters if assertions are enabled. */
- wimlib_assert2((uintptr_t)decode_table % DECODE_TABLE_ALIGNMENT == 0);
- wimlib_assert2(num_syms <= DECODE_TABLE_MAX_SYMBOLS);
- wimlib_assert2(table_bits <= DECODE_TABLE_MAX_TABLE_BITS);
- wimlib_assert2(max_codeword_len <= DECODE_TABLE_MAX_CODEWORD_LEN);
- for (unsigned sym = 0; sym < num_syms; sym++)
- wimlib_assert2(lens[sym] <= max_codeword_len);
-
/* Count how many symbols have each possible codeword length.
* Note that a length of 0 indicates the corresponding symbol is not
* used in the code and therefore does not have a codeword. */