Roll WebRTC 9217:9227, Libjingle 9216:9227
[chromium-blink-merge.git] / third_party / lzma_sdk / Bra.h
blob5748c1c051d4e8f9c61938a0f37c8e5994e8d4ed
1 /* Bra.h -- Branch converters for executables
2 2009-02-07 : Igor Pavlov : Public domain */
4 #ifndef __BRA_H
5 #define __BRA_H
7 #include "Types.h"
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
14 These functions convert relative addresses to absolute addresses
15 in CALL instructions to increase the compression ratio.
17 In:
18 data - data buffer
19 size - size of data
20 ip - current virtual Instruction Pinter (IP) value
21 state - state variable for x86 converter
22 encoding - 0 (for decoding), 1 (for encoding)
24 Out:
25 state - state variable for x86 converter
27 Returns:
28 The number of processed bytes. If you call these functions with multiple calls,
29 you must start next call with first byte after block of processed bytes.
31 Type Endian Alignment LookAhead
33 x86 little 1 4
34 ARMT little 2 2
35 ARM little 4 0
36 PPC big 4 0
37 SPARC big 4 0
38 IA64 little 16 0
40 size must be >= Alignment + LookAhead, if it's not last block.
41 If (size < Alignment + LookAhead), converter returns 0.
43 Example:
45 UInt32 ip = 0;
46 for ()
48 ; size must be >= Alignment + LookAhead, if it's not last block
49 SizeT processed = Convert(data, size, ip, 1);
50 data += processed;
51 size -= processed;
52 ip += processed;
56 #define x86_Convert_Init(state) { state = 0; }
57 SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding);
58 SizeT ARM_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
59 SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
60 SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
61 SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
62 SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
64 #ifdef __cplusplus
66 #endif
68 #endif