misc/libphysfs/lzma/C/Compress/Branch/BranchARM.c
branchui-scaling
changeset 15283 c4fd2813b127
parent 13390 0135e64c6c66
parent 15279 7ab5cf405686
child 15663 d92eeb468dad
equal deleted inserted replaced
13390:0135e64c6c66 15283:c4fd2813b127
     1 /* BranchARM.c */
       
     2 
       
     3 #include "BranchARM.h"
       
     4 
       
     5 UInt32 ARM_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 + 3] == 0xEB)
       
    11     {
       
    12       UInt32 dest;
       
    13       UInt32 src = (data[i + 2] << 16) | (data[i + 1] << 8) | (data[i + 0]);
       
    14       src <<= 2;
       
    15       if (encoding)
       
    16         dest = nowPos + i + 8 + src;
       
    17       else
       
    18         dest = src - (nowPos + i + 8);
       
    19       dest >>= 2;
       
    20       data[i + 2] = (Byte)(dest >> 16);
       
    21       data[i + 1] = (Byte)(dest >> 8);
       
    22       data[i + 0] = (Byte)dest;
       
    23     }
       
    24   }
       
    25   return i;
       
    26 }