summaryrefslogtreecommitdiffstats
path: root/hostTools/lzma/decompress/WindowOut.h
blob: d774cac9738115af6f2a0bbd789af7adcae0c2e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef __STREAM_WINDOWOUT_H
#define __STREAM_WINDOWOUT_H

#include "IInOutStreams.h"

typedef struct WindowOut
{
  BYTE  *Buffer;
  UINT32 Pos;
} WindowOut;

extern WindowOut out_window;

#define OutWindowInit() \
  { \
    out_window.Buffer = (BYTE *) out_stream.data; \
    out_window.Pos = 0; \
  }

#define OutWindowFlush() \
  { \
    OutStreamSizeSet( out_window.Pos ); \
  } 

// BRCM modification 
INLINE void OutWindowCopyBackBlock(UINT32 aDistance, UINT32 aLen)
  {
    BYTE   *p = out_window.Buffer + out_window.Pos;
    UINT32  i;
    aDistance++;
    for(i = 0; i < aLen; i++)
      p[i] = p[i - aDistance];
    out_window.Pos += aLen;
  }


#define OutWindowPutOneByte(aByte) \
  { \
    out_window.Buffer[out_window.Pos++] = aByte; \
  } 

#define OutWindowGetOneByte(anIndex) \
     (out_window.Buffer[out_window.Pos + anIndex])



#endif