view src/win32/7zip/7z/C/Bra.h @ 1:f9f4f1b99eed

importing src directory
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:31:27 -0600
parents
children
line wrap: on
line source
1 /* Bra.h -- Branch converters for executables
2 2008-10-04 : Igor Pavlov : Public domain */
4 #ifndef __BRA_H
5 #define __BRA_H
7 #include "Types.h"
9 /*
10 These functions convert relative addresses to absolute addresses
11 in CALL instructions to increase the compression ratio.
13 In:
14 data - data buffer
15 size - size of data
16 ip - current virtual Instruction Pinter (IP) value
17 state - state variable for x86 converter
18 encoding - 0 (for decoding), 1 (for encoding)
20 Out:
21 state - state variable for x86 converter
23 Returns:
24 The number of processed bytes. If you call these functions with multiple calls,
25 you must start next call with first byte after block of processed bytes.
27 Type Endian Alignment LookAhead
29 x86 little 1 4
30 ARMT little 2 2
31 ARM little 4 0
32 PPC big 4 0
33 SPARC big 4 0
34 IA64 little 16 0
36 size must be >= Alignment + LookAhead, if it's not last block.
37 If (size < Alignment + LookAhead), converter returns 0.
39 Example:
41 UInt32 ip = 0;
42 for ()
43 {
44 ; size must be >= Alignment + LookAhead, if it's not last block
45 SizeT processed = Convert(data, size, ip, 1);
46 data += processed;
47 size -= processed;
48 ip += processed;
49 }
50 */
52 #define x86_Convert_Init(state) { state = 0; }
53 SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding);
54 SizeT ARM_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
55 SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
56 SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
57 SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
58 SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
60 #endif