diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/win32/7zip/7z/C/Bra.h	Sat Mar 03 10:31:27 2012 -0600
     1.3 @@ -0,0 +1,60 @@
     1.4 +/* Bra.h -- Branch converters for executables
     1.5 +2008-10-04 : Igor Pavlov : Public domain */
     1.6 +
     1.7 +#ifndef __BRA_H
     1.8 +#define __BRA_H
     1.9 +
    1.10 +#include "Types.h"
    1.11 +
    1.12 +/*
    1.13 +These functions convert relative addresses to absolute addresses
    1.14 +in CALL instructions to increase the compression ratio.
    1.15 +  
    1.16 +  In:
    1.17 +    data     - data buffer
    1.18 +    size     - size of data
    1.19 +    ip       - current virtual Instruction Pinter (IP) value
    1.20 +    state    - state variable for x86 converter
    1.21 +    encoding - 0 (for decoding), 1 (for encoding)
    1.22 +  
    1.23 +  Out:
    1.24 +    state    - state variable for x86 converter
    1.25 +
    1.26 +  Returns:
    1.27 +    The number of processed bytes. If you call these functions with multiple calls,
    1.28 +    you must start next call with first byte after block of processed bytes.
    1.29 +  
    1.30 +  Type   Endian  Alignment  LookAhead
    1.31 +  
    1.32 +  x86    little      1          4
    1.33 +  ARMT   little      2          2
    1.34 +  ARM    little      4          0
    1.35 +  PPC     big        4          0
    1.36 +  SPARC   big        4          0
    1.37 +  IA64   little     16          0
    1.38 +
    1.39 +  size must be >= Alignment + LookAhead, if it's not last block.
    1.40 +  If (size < Alignment + LookAhead), converter returns 0.
    1.41 +
    1.42 +  Example:
    1.43 +
    1.44 +    UInt32 ip = 0;
    1.45 +    for ()
    1.46 +    {
    1.47 +      ; size must be >= Alignment + LookAhead, if it's not last block
    1.48 +      SizeT processed = Convert(data, size, ip, 1);
    1.49 +      data += processed;
    1.50 +      size -= processed;
    1.51 +      ip += processed;
    1.52 +    }
    1.53 +*/
    1.54 +
    1.55 +#define x86_Convert_Init(state) { state = 0; }
    1.56 +SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding);
    1.57 +SizeT ARM_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
    1.58 +SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
    1.59 +SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
    1.60 +SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
    1.61 +SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
    1.62 +
    1.63 +#endif