X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Flzms_compress.c;h=ef67edb213f79fa2c1bf2b1057568a28e93d7fa5;hb=c97b3097024081df0e955171363f8e727b115440;hp=f438e91cd15156f48e8371f3bf5f1cc6aa044413;hpb=5343bde03c158cc767b1a347a7323d0e33c78d41;p=wimlib diff --git a/src/lzms_compress.c b/src/lzms_compress.c index f438e91c..ef67edb2 100644 --- a/src/lzms_compress.c +++ b/src/lzms_compress.c @@ -173,7 +173,7 @@ struct lzms_item { 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 @@ -975,7 +975,7 @@ static inline void 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 @@ -1180,7 +1180,7 @@ static void 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 @@ -1203,7 +1203,7 @@ lzms_delta_hash(const u8 *p, const u32 pos, u32 span) * 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); @@ -1248,7 +1248,7 @@ lzms_delta_matchfinder_skip_bytes(struct lzms_compressor *c, 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); } @@ -1712,7 +1712,7 @@ begin: 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; @@ -1726,7 +1726,7 @@ begin: 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; @@ -1741,7 +1741,7 @@ begin: /* 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)) !=