From: Eric Biggers Date: Sat, 21 Nov 2015 02:28:39 +0000 (-0600) Subject: Adjust names of get/put unaligned functions X-Git-Tag: v1.9.0~52 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=0096c56e9a0ee15f708523075d67ea7a1d77b456 Adjust names of get/put unaligned functions get_unaligned_u16_le => get_unaligned_le16 get_unaligned_u32_le => get_unaligned_le32 put_unaligned_u16_le => put_unaligned_le16 put_unaligned_u32_le => put_unaligned_le32 --- diff --git a/include/wimlib/decompress_common.h b/include/wimlib/decompress_common.h index 5d7c4e5a..4bfaf251 100644 --- a/include/wimlib/decompress_common.h +++ b/include/wimlib/decompress_common.h @@ -67,7 +67,7 @@ bitstream_ensure_bits(struct input_bitstream *is, const unsigned num_bits) if (unlikely(is->end - is->next < 2)) goto overflow; - is->bitbuf |= (u32)get_unaligned_u16_le(is->next) << (16 - is->bitsleft); + is->bitbuf |= (u32)get_unaligned_le16(is->next) << (16 - is->bitsleft); is->next += 2; is->bitsleft += 16; @@ -75,7 +75,7 @@ bitstream_ensure_bits(struct input_bitstream *is, const unsigned num_bits) if (unlikely(is->end - is->next < 2)) goto overflow; - is->bitbuf |= (u32)get_unaligned_u16_le(is->next); + is->bitbuf |= (u32)get_unaligned_le16(is->next); is->next += 2; is->bitsleft = 32; } @@ -141,7 +141,7 @@ bitstream_read_u16(struct input_bitstream *is) if (unlikely(is->end - is->next < 2)) return 0; - v = get_unaligned_u16_le(is->next); + v = get_unaligned_le16(is->next); is->next += 2; return v; } @@ -154,7 +154,7 @@ bitstream_read_u32(struct input_bitstream *is) if (unlikely(is->end - is->next < 4)) return 0; - v = get_unaligned_u32_le(is->next); + v = get_unaligned_le32(is->next); is->next += 4; return v; } diff --git a/include/wimlib/unaligned.h b/include/wimlib/unaligned.h index 3fd35a4d..3bd6d542 100644 --- a/include/wimlib/unaligned.h +++ b/include/wimlib/unaligned.h @@ -50,7 +50,7 @@ DEFINE_UNALIGNED_TYPE(machine_word_t); #define store_word_unaligned store_machine_word_t_unaligned static inline u16 -get_unaligned_u16_le(const void *p) +get_unaligned_le16(const void *p) { u16 v; @@ -66,7 +66,7 @@ get_unaligned_u16_le(const void *p) } static inline u32 -get_unaligned_u32_le(const void *p) +get_unaligned_le32(const void *p) { u32 v; @@ -84,7 +84,7 @@ get_unaligned_u32_le(const void *p) } static inline void -put_unaligned_u16_le(u16 v, void *p) +put_unaligned_le16(u16 v, void *p) { if (UNALIGNED_ACCESS_IS_FAST) { store_le16_unaligned(cpu_to_le16(v), p); @@ -96,7 +96,7 @@ put_unaligned_u16_le(u16 v, void *p) } static inline void -put_unaligned_u32_le(u32 v, void *p) +put_unaligned_le32(u32 v, void *p) { if (UNALIGNED_ACCESS_IS_FAST) { store_le32_unaligned(cpu_to_le32(v), p); diff --git a/src/lzms_common.c b/src/lzms_common.c index 47c07117..57c17d4d 100644 --- a/src/lzms_common.c +++ b/src/lzms_common.c @@ -516,15 +516,15 @@ have_opcode: p += opcode_nbytes; if (undo) { if (i - *last_x86_pos <= max_trans_offset) { - u32 n = get_unaligned_u32_le(p); - put_unaligned_u32_le(n - i, p); + u32 n = get_unaligned_le32(p); + put_unaligned_le32(n - i, p); } - target16 = i + get_unaligned_u16_le(p); + target16 = i + get_unaligned_le16(p); } else { - target16 = i + get_unaligned_u16_le(p); + target16 = i + get_unaligned_le16(p); if (i - *last_x86_pos <= max_trans_offset) { - u32 n = get_unaligned_u32_le(p); - put_unaligned_u32_le(n + i, p); + u32 n = get_unaligned_le32(p); + put_unaligned_le32(n + i, p); } } diff --git a/src/lzms_compress.c b/src/lzms_compress.c index e811a876..f42a46ee 100644 --- a/src/lzms_compress.c +++ b/src/lzms_compress.c @@ -498,7 +498,7 @@ lzms_range_encoder_shift_low(struct lzms_range_encoder *rc) do { if (likely(rc->next >= rc->begin)) { if (rc->next != rc->end) { - put_unaligned_u16_le(rc->cache + + put_unaligned_le16(rc->cache + (u16)(rc->lower_bound >> 32), rc->next++); } @@ -658,7 +658,7 @@ lzms_write_bits(struct lzms_output_bitstream *os, const u32 bits, /* Write a coding unit, unless it would underflow the buffer. */ if (os->next != os->begin) - put_unaligned_u16_le(os->bitbuf >> os->bitcount, --os->next); + put_unaligned_le16(os->bitbuf >> os->bitcount, --os->next); /* Optimization for call sites that never write more than 16 * bits at once. */ @@ -679,7 +679,7 @@ lzms_output_bitstream_flush(struct lzms_output_bitstream *os) return false; if (os->bitcount != 0) - put_unaligned_u16_le(os->bitbuf << (16 - os->bitcount), --os->next); + put_unaligned_le16(os->bitbuf << (16 - os->bitcount), --os->next); return true; } diff --git a/src/lzx_common.c b/src/lzx_common.c index 0677e0a0..f5c8f89a 100644 --- a/src/lzx_common.c +++ b/src/lzx_common.c @@ -114,7 +114,7 @@ do_translate_target(void *target, s32 input_pos) { s32 abs_offset, rel_offset; - rel_offset = get_unaligned_u32_le(target); + rel_offset = get_unaligned_le32(target); if (rel_offset >= -input_pos && rel_offset < LZX_WIM_MAGIC_FILESIZE) { if (rel_offset < LZX_WIM_MAGIC_FILESIZE - input_pos) { /* "good translation" */ @@ -123,7 +123,7 @@ do_translate_target(void *target, s32 input_pos) /* "compensating translation" */ abs_offset = rel_offset - LZX_WIM_MAGIC_FILESIZE; } - put_unaligned_u32_le(abs_offset, target); + put_unaligned_le32(abs_offset, target); } } @@ -132,18 +132,18 @@ undo_translate_target(void *target, s32 input_pos) { s32 abs_offset, rel_offset; - abs_offset = get_unaligned_u32_le(target); + abs_offset = get_unaligned_le32(target); if (abs_offset >= 0) { if (abs_offset < LZX_WIM_MAGIC_FILESIZE) { /* "good translation" */ rel_offset = abs_offset - input_pos; - put_unaligned_u32_le(rel_offset, target); + put_unaligned_le32(rel_offset, target); } } else { if (abs_offset >= -input_pos) { /* "compensating translation" */ rel_offset = abs_offset + LZX_WIM_MAGIC_FILESIZE; - put_unaligned_u32_le(rel_offset, target); + put_unaligned_le32(rel_offset, target); } } } diff --git a/src/lzx_compress.c b/src/lzx_compress.c index 520c07e3..6a631db9 100644 --- a/src/lzx_compress.c +++ b/src/lzx_compress.c @@ -586,13 +586,13 @@ lzx_flush_bits(struct lzx_output_bitstream *os, unsigned max_num_bits) if (os->end - os->next < 6) return; - put_unaligned_u16_le(os->bitbuf >> ((os->bitcount - 16) & + put_unaligned_le16(os->bitbuf >> ((os->bitcount - 16) & shift_mask), os->next + 0); if (max_num_bits > 16) - put_unaligned_u16_le(os->bitbuf >> ((os->bitcount - 32) & + put_unaligned_le16(os->bitbuf >> ((os->bitcount - 32) & shift_mask), os->next + 2); if (max_num_bits > 32) - put_unaligned_u16_le(os->bitbuf >> ((os->bitcount - 48) & + put_unaligned_le16(os->bitbuf >> ((os->bitcount - 48) & shift_mask), os->next + 4); os->next += (os->bitcount >> 4) << 1; os->bitcount &= 15; @@ -617,7 +617,7 @@ lzx_flush_output(struct lzx_output_bitstream *os) return 0; if (os->bitcount != 0) { - put_unaligned_u16_le(os->bitbuf << (16 - os->bitcount), os->next); + put_unaligned_le16(os->bitbuf << (16 - os->bitcount), os->next); os->next += 2; } diff --git a/src/xpress_compress.c b/src/xpress_compress.c index 7ebff876..edc126d9 100644 --- a/src/xpress_compress.c +++ b/src/xpress_compress.c @@ -292,7 +292,7 @@ xpress_write_bits(struct xpress_output_bitstream *os, if (os->bitcount > 16) { os->bitcount -= 16; if (os->end - os->next_byte >= 2) { - put_unaligned_u16_le(os->bitbuf >> os->bitcount, os->next_bits); + put_unaligned_le16(os->bitbuf >> os->bitcount, os->next_bits); os->next_bits = os->next_bits2; os->next_bits2 = os->next_byte; os->next_byte += 2; @@ -317,7 +317,7 @@ static inline void xpress_write_u16(struct xpress_output_bitstream *os, u16 v) { if (os->end - os->next_byte >= 2) { - put_unaligned_u16_le(v, os->next_byte); + put_unaligned_le16(v, os->next_byte); os->next_byte += 2; } } @@ -332,8 +332,8 @@ xpress_flush_output(struct xpress_output_bitstream *os) if (os->end - os->next_byte < 2) return 0; - put_unaligned_u16_le(os->bitbuf << (16 - os->bitcount), os->next_bits); - put_unaligned_u16_le(0, os->next_bits2); + put_unaligned_le16(os->bitbuf << (16 - os->bitcount), os->next_bits); + put_unaligned_le16(0, os->next_bits2); return os->next_byte - os->start; }