-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCOMP_FUN.CPP
More file actions
44 lines (37 loc) · 810 Bytes
/
COMP_FUN.CPP
File metadata and controls
44 lines (37 loc) · 810 Bytes
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
/* Decompress Function */
void FileCompress::Do_Decompress(unsigned char *DStr)
{
int j=0;
int Compval;
int i,k,flag;
static unsigned char Rchar='\0';
while(*DStr !='\0')
{
Compval=128;
for(k=0;k<8;k++)
{
Rchar|=(*DStr & Compval) ? 1:0; // Get the decompressed character from the compressed file
Compval>>=1;
j++;
flag=1;
if (j >=Min_BitSize) // Check the bit size with Minimum bit size
{
Rchar <<=(8-j);
for(i=0;i<255;i++)
{
if(j==Thead[i].Nbits && Rchar==Thead[i].Bvalue) // Check the bit size and shift value with table datas
{
cout << Thead[i].Data ;
Rchar ='\0';
j=0; flag=0;
break;
}
}
if(flag==1)
Rchar >>=(8-j);
}
Rchar <<=1;
}
*DStr++;
}
}