diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/avi/intern/endian.c | 31 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_endian_switch_inline.h | 2 |
2 files changed, 12 insertions, 21 deletions
diff --git a/source/blender/avi/intern/endian.c b/source/blender/avi/intern/endian.c index c9b95d25810..8e5ed80f5a0 100644 --- a/source/blender/avi/intern/endian.c +++ b/source/blender/avi/intern/endian.c @@ -46,31 +46,22 @@ #endif #ifdef __BIG_ENDIAN__ + +/* copied from BLI_endian_switch_inline.h */ static void invert(int *num) { - int new = 0, i, j; - - for (j = 0; j < 4; j++) { - for (i = 0; i < 8; i++) { - new |= ((*num >> (j * 8 + i)) & 1) << ((3 - j) * 8 + i); - } - } - - *num = new; + int tval = *val; + *val = ((tval >> 24)) | + ((tval << 8) & 0x00ff0000) | + ((tval >> 8) & 0x0000ff00) | + ((tval << 24)); } -static void sinvert(short int *num) +static void sinvert(short int *val) { - short int new = 0; - int i, j; - - for (j = 0; j < 2; j++) { - for (i = 0; i < 8; i++) { - new |= ((*num >> (j * 8 + i)) & 1) << ((1 - j) * 8 + i); - } - } - - *num = new; + short tval = *val; + *val = (tval >> 8) | + (tval << 8); } static void Ichunk(AviChunk *chunk) diff --git a/source/blender/blenlib/BLI_endian_switch_inline.h b/source/blender/blenlib/BLI_endian_switch_inline.h index 6694276a995..948d462fde4 100644 --- a/source/blender/blenlib/BLI_endian_switch_inline.h +++ b/source/blender/blenlib/BLI_endian_switch_inline.h @@ -40,7 +40,7 @@ BLI_INLINE void BLI_endian_switch_int16(short *val) { short tval = *val; *val = (tval >> 8) | - (tval << 8); + (tval << 8); } BLI_INLINE void BLI_endian_switch_uint16(unsigned short *val) |