static inline void
check_that_powers_fit_in_bitfield(void)
{
- BUILD_BUG_ON(LZMS_NUM_DELTA_POWER_SYMS > (1 << (31 - DELTA_SOURCE_POWER_SHIFT)));
+ STATIC_ASSERT(LZMS_NUM_DELTA_POWER_SYMS <= (1 << (31 - DELTA_SOURCE_POWER_SHIFT)));
}
/* A stripped-down version of the adaptive state in LZMS which excludes the
*
* Note: this adaptive state structure also does not include the
* probability entries or current Huffman codewords. Those aren't
- * maintained per-position and are only updated occassionally.
+ * maintained per-position and are only updated occasionally.
*/
struct lzms_adaptive_state state;
} _aligned_attribute(64);
check_cost_shift(void)
{
/* lzms_bit_costs is hard-coded to the current COST_SHIFT. */
- BUILD_BUG_ON(COST_SHIFT != 6);
+ STATIC_ASSERT(COST_SHIFT == 6);
}
#if 0
lzms_init_delta_matchfinder(struct lzms_compressor *c)
{
/* Set all entries to use an invalid power, which will never match. */
- BUILD_BUG_ON(NUM_POWERS_TO_CONSIDER >= (1 << (32 - DELTA_SOURCE_POWER_SHIFT)));
+ STATIC_ASSERT(NUM_POWERS_TO_CONSIDER < (1 << (32 - DELTA_SOURCE_POWER_SHIFT)));
memset(c->delta_hash_table, 0xFF, sizeof(c->delta_hash_table));
/* Initialize the next hash code for each power. We can just use zeroes
* include in the hash code computation the span and the low-order bits
* of the current position. */
- BUILD_BUG_ON(NBYTES_HASHED_FOR_DELTA != 3);
+ STATIC_ASSERT(NBYTES_HASHED_FOR_DELTA == 3);
u8 d0 = *(p + 0) - *(p + 0 - span);
u8 d1 = *(p + 1) - *(p + 1 - span);
u8 d2 = *(p + 2) - *(p + 2 - span);
c->delta_hash_table[hash] =
(power << DELTA_SOURCE_POWER_SHIFT) | pos;
c->next_delta_hashes[power] = next_hash;
- prefetch(&c->delta_hash_table[next_hash]);
+ prefetchw(&c->delta_hash_table[next_hash]);
}
} while (in_next++, pos++, --count);
}
const u32 pos = in_next - c->in_buffer;
/* Consider each possible power (log2 of span) */
- BUILD_BUG_ON(NUM_POWERS_TO_CONSIDER > LZMS_NUM_DELTA_POWER_SYMS);
+ STATIC_ASSERT(NUM_POWERS_TO_CONSIDER <= LZMS_NUM_DELTA_POWER_SYMS);
for (u32 power = 0; power < NUM_POWERS_TO_CONSIDER; power++) {
const u32 span = (u32)1 << power;
c->delta_hash_table[hash] = (power << DELTA_SOURCE_POWER_SHIFT) | pos;
c->next_delta_hashes[power] = next_hash;
- prefetch(&c->delta_hash_table[next_hash]);
+ prefetchw(&c->delta_hash_table[next_hash]);
if (power != cur_match >> DELTA_SOURCE_POWER_SHIFT)
continue;
/* Check the first 3 bytes before entering the
* extension loop. */
- BUILD_BUG_ON(NBYTES_HASHED_FOR_DELTA != 3);
+ STATIC_ASSERT(NBYTES_HASHED_FOR_DELTA == 3);
if (((u8)(*(in_next + 0) - *(in_next + 0 - span)) !=
(u8)(*(matchptr + 0) - *(matchptr + 0 - span))) ||
((u8)(*(in_next + 1) - *(in_next + 1 - span)) !=