~ubuntu-installer/wubi/trunk

« back to all changes in this revision

Viewing changes to src/7z/C/Compress/Branch/BranchSPARC.c

  • Committer: Agostino Russo
  • Date: 2008-12-04 00:37:30 UTC
  • Revision ID: agostino.russo@gmail.com-20081204003730-3o051yp78d6ujckl
* Bumped version to 9.04
* Added required binaries (will be compiled at a later stage)
* Added uninstallation page
* Added BitTorrent source
* Added documentation and licenses
* Connected download managers
* Fixed download status updates
* Added more information to the README
* Made the tasklist thread daemonic so that it does not prevent the
  main application from quitting

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
      UInt32 dest;
 
19
      
 
20
      src <<= 2;
 
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
}