Adjust names of get/put unaligned functions
authorEric Biggers <ebiggers3@gmail.com>
Sat, 21 Nov 2015 02:28:39 +0000 (20:28 -0600)
committerEric Biggers <ebiggers3@gmail.com>
Sat, 21 Nov 2015 02:28:39 +0000 (20:28 -0600)
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

include/wimlib/decompress_common.h
include/wimlib/unaligned.h
src/lzms_common.c
src/lzms_compress.c
src/lzx_common.c
src/lzx_compress.c
src/xpress_compress.c

index 5d7c4e5..4bfaf25 100644 (file)
@@ -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;
 }
index 3fd35a4..3bd6d54 100644 (file)
@@ -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);
index 47c0711..57c17d4 100644 (file)
@@ -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);
                }
        }
 
index e811a87..f42a46e 100644 (file)
@@ -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;
 }
index 0677e0a..f5c8f89 100644 (file)
@@ -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);
                }
        }
 }
index 520c07e..6a631db 100644 (file)
@@ -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;
        }
 
index 7ebff87..edc126d 100644 (file)
@@ -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;
 }