Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-10-07 10:06:28 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-10-07 10:06:28 +0400
commitc530661db21ce882d4b5ef16d64ed5fc8f469761 (patch)
treef9e26f96bcd61409c94fc577087273ab198b1d94 /source/blender/avi
parenta17e39476cf3d7bc7724e5d259d0c3572cdb08dc (diff)
patch [#32556] Stupid endian conversion in avi format
from Andreas Schwab (schwab) modified to use code from BLI_endian_switch.
Diffstat (limited to 'source/blender/avi')
-rw-r--r--source/blender/avi/intern/endian.c31
1 files changed, 11 insertions, 20 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)