Annotation of elwix/tools/oldlzma/SRC/7zip/Compress/Branch/BranchSPARC.c, revision 1.1.1.1
1.1 misho 1: // BranchSPARC.c
2:
3: #include "BranchSPARC.h"
4:
5: UInt32 SPARC_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding)
6: {
7: UInt32 i;
8: for (i = 0; i + 4 <= size; i += 4)
9: {
10: if (data[i] == 0x40 && (data[i + 1] & 0xC0) == 0x00 ||
11: data[i] == 0x7F && (data[i + 1] & 0xC0) == 0xC0)
12: {
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]);
18:
19: src <<= 2;
20: UInt32 dest;
21: if (encoding)
22: dest = nowPos + i + src;
23: else
24: dest = src - (nowPos + i);
25: dest >>= 2;
26:
27: dest = (((0 - ((dest >> 22) & 1)) << 22) & 0x3FFFFFFF) | (dest & 0x3FFFFF) | 0x40000000;
28:
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;
33: }
34: }
35: return i;
36: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>