Skip to content

Commit

Permalink
libflzma: Read hash input with unaligned access helper instead of macro
Browse files Browse the repository at this point in the history
  • Loading branch information
Conor McCarthy committed Sep 15, 2019
1 parent b32946f commit 7f27ac7
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/liblzma/lzma/lzma2_encoder_rmf.c
Expand Up @@ -660,15 +660,11 @@ lzma2_rmf_hash_alloc(lzma2_rmf_encoder *const enc, const lzma_options_lzma* cons
}


#ifdef TUKLIB_FAST_UNALIGNED_ACCESS
# ifdef WORDS_BIGENDIAN
# define GET_HASH_3(data) (((*(uint32_t*)(data) & 0xFFFFFF00) * 506832829U) >> (32 - HC3_BITS))
# define GET_HASH_3(data) (((unaligned_read32ne(data) & 0xFFFFFF00) * 506832829U) >> (32 - HC3_BITS))
# else
# define GET_HASH_3(data) (((*(uint32_t*)(data) << 8) * 506832829U) >> (32 - HC3_BITS))
# define GET_HASH_3(data) (((unaligned_read32ne(data) << 8) * 506832829U) >> (32 - HC3_BITS))
# endif
#else
# define GET_HASH_3(data) (((((unsigned)((data)[0]) << 8) | ((data)[1] << 16) | ((data)[2] << 24)) * 506832829U) >> (32 - HC3_BITS))
#endif

// Find matches nearer than the match from the RMF. If none is at least as long as
// the RMF match (most likely), insert that match at the end of the list.
Expand Down

0 comments on commit 7f27ac7

Please sign in to comment.