]> wimlib.net Git - wimlib/commitdiff
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 5d7c4e5abb441ce5e3fe625869c673d1a4b4b234..4bfaf251151643fd2d812d1619ca2482aeea9047 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;
 
        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;
 
        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;
 
                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;
        }
                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;
 
        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;
 }
        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;
 
        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;
 }
        is->next += 4;
        return v;
 }
index 3fd35a4df107e7e9140c9603e45fc6445405ebd6..3bd6d542b2b1f05b03da6d877fd5a32dcda0b850 100644 (file)
@@ -50,7 +50,7 @@ DEFINE_UNALIGNED_TYPE(machine_word_t);
 #define store_word_unaligned   store_machine_word_t_unaligned
 
 static inline u16
 #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;
 
 {
        u16 v;
 
@@ -66,7 +66,7 @@ get_unaligned_u16_le(const void *p)
 }
 
 static inline u32
 }
 
 static inline u32
-get_unaligned_u32_le(const void *p)
+get_unaligned_le32(const void *p)
 {
        u32 v;
 
 {
        u32 v;
 
@@ -84,7 +84,7 @@ get_unaligned_u32_le(const void *p)
 }
 
 static inline void
 }
 
 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);
 {
        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
 }
 
 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);
 {
        if (UNALIGNED_ACCESS_IS_FAST) {
                store_le32_unaligned(cpu_to_le32(v), p);
index 47c071178940732b8eb8e6a03883c770be5132cb..57c17d4d3a5a1ba9bf3b5acff6edcbfeb0a0cb4b 100644 (file)
@@ -516,15 +516,15 @@ have_opcode:
        p += opcode_nbytes;
        if (undo) {
                if (i - *last_x86_pos <= max_trans_offset) {
        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 {
        } else {
-               target16 = i + get_unaligned_u16_le(p);
+               target16 = i + get_unaligned_le16(p);
                if (i - *last_x86_pos <= max_trans_offset) {
                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 e811a87658bda5eea3db465bf5c446f068a6229e..f42a46ee2fe8d82292265dd5d9685c7bf9f5bbdf 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) {
                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++);
                                }
                                                             (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)
 
                /* 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.  */
 
                /* 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)
                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;
 }
 
        return true;
 }
index 0677e0a0d40693a37888c431b521771621ad60e1..f5c8f89a7a0471202c752efd384a6f8c811eadb9 100644 (file)
@@ -114,7 +114,7 @@ do_translate_target(void *target, s32 input_pos)
 {
        s32 abs_offset, rel_offset;
 
 {
        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" */
        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;
                }
                        /* "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;
 
 {
        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;
        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;
                }
        } 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 520c07e33572081b7756a9c3622733522569817a..6a631db9ae37f7738fccd3e1b544e28c99dcb75e 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;
 
        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)
                                            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)
                                                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;
                                                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) {
                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;
        }
 
                os->next += 2;
        }
 
index 7ebff8766339862de7f31aaabc8f99589fe3c7f8..edc126d9310e3b10a6eb49895b393dd3f8c96708 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) {
        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;
                        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) {
 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;
        }
 }
                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;
 
        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;
 }
 
        return os->next_byte - os->start;
 }