Don't rely on LSB_FIRST

This commit is contained in:
twinaphex
2015-07-23 22:18:46 +02:00
parent 46ac3a807b
commit 5cfa9e8ac9
9 changed files with 62 additions and 60 deletions

View File

@@ -108,14 +108,14 @@ static int SubWrite(MEM_TYPE *st, SFORMAT *sf) {
fwrite(sf->desc, 1, 4, st);
write32le(sf->s & (~RLSB), st);
#ifndef LSB_FIRST
#ifdef MSB_FIRST
if (sf->s & RLSB)
FlipByteOrder(sf->v, sf->s & (~RLSB));
#endif
fwrite((uint8*)sf->v, 1, sf->s & (~RLSB), st);
/* Now restore the original byte order. */
#ifndef LSB_FIRST
#ifdef MSB_FIRST
if (sf->s & RLSB)
FlipByteOrder(sf->v, sf->s & (~RLSB));
#endif
@@ -173,7 +173,7 @@ static int ReadStateChunk(MEM_TYPE *st, SFORMAT *sf, int size) {
if ((tmp = CheckS(sf, tsize, toa))) {
fread((uint8*)tmp->v, 1, tmp->s & (~RLSB), st);
#ifndef LSB_FIRST
#ifdef MSB_FIRST
if (tmp->s & RLSB)
FlipByteOrder(tmp->v, tmp->s & (~RLSB));
#endif