Annotation of elwix/tools/oldlzma/SRC/7zip/Compress/Branch/BranchARMThumb.c, revision 1.1
1.1 ! misho 1: // BranchARMThumb.c
! 2:
! 3: #include "BranchARMThumb.h"
! 4:
! 5: UInt32 ARMThumb_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding)
! 6: {
! 7: UInt32 i;
! 8: for (i = 0; i + 4 <= size; i += 2)
! 9: {
! 10: if ((data[i + 1] & 0xF8) == 0xF0 &&
! 11: (data[i + 3] & 0xF8) == 0xF8)
! 12: {
! 13: UInt32 src =
! 14: ((data[i + 1] & 0x7) << 19) |
! 15: (data[i + 0] << 11) |
! 16: ((data[i + 3] & 0x7) << 8) |
! 17: (data[i + 2]);
! 18:
! 19: src <<= 1;
! 20: UInt32 dest;
! 21: if (encoding)
! 22: dest = nowPos + i + 4 + src;
! 23: else
! 24: dest = src - (nowPos + i + 4);
! 25: dest >>= 1;
! 26:
! 27: data[i + 1] = 0xF0 | ((dest >> 19) & 0x7);
! 28: data[i + 0] = (dest >> 11);
! 29: data[i + 3] = 0xF8 | ((dest >> 8) & 0x7);
! 30: data[i + 2] = (dest);
! 31: i += 2;
! 32: }
! 33: }
! 34: return i;
! 35: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>