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