#include #include // table with predictions char pcTable[32768U]; // macro to calculate index in pctable from previous 2 characters #define INDEX(p1,p2) (((unsigned)(unsigned char)p1<<7)^(unsigned char)p2) void Compress (FILE *pfIn, FILE *pfOut){ int c; // character int i; // loop counter char p1=0, p2=0; // previous 2 characters char buf[8]; // keeps characters temporarily int ctr=0; // number of characters in mask int bctr=0; // position in buf unsigned char mask=0; // mask to mark successful predictions memset (pcTable, 32, 32768U); // space (ASCII 32) is the most used char c = fgetc (pfIn); while (c!=EOF){ // try to predict the next character if (pcTable[INDEX(p1,p2)]==(char)c){ // correct prediction, mark bit for correct prediction mask = mask ^ (1<