allow coexistance of N build and AC build.
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / scripts / squashfs / lzma / C / 7zip / Compress / Branch / BranchSPARC.c
blobabbf1d75b301ed29024d89ecb797422ac524c08b
1 // BranchSPARC.c
3 #include "BranchSPARC.h"
5 UInt32 SPARC_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding)
7 UInt32 i;
8 for (i = 0; i + 4 <= size; i += 4)
10 if (data[i] == 0x40 && (data[i + 1] & 0xC0) == 0x00 ||
11 data[i] == 0x7F && (data[i + 1] & 0xC0) == 0xC0)
13 UInt32 src =
14 ((UInt32)data[i + 0] << 24) |
15 ((UInt32)data[i + 1] << 16) |
16 ((UInt32)data[i + 2] << 8) |
17 ((UInt32)data[i + 3]);
19 src <<= 2;
20 UInt32 dest;
21 if (encoding)
22 dest = nowPos + i + src;
23 else
24 dest = src - (nowPos + i);
25 dest >>= 2;
27 dest = (((0 - ((dest >> 22) & 1)) << 22) & 0x3FFFFFFF) | (dest & 0x3FFFFF) | 0x40000000;
29 data[i + 0] = (Byte)(dest >> 24);
30 data[i + 1] = (Byte)(dest >> 16);
31 data[i + 2] = (Byte)(dest >> 8);
32 data[i + 3] = (Byte)dest;
35 return i;