/***** repost 8-22-96 entropy : 6.039 *****/ /***** Hi all, this is a C source code; it compiles and runs. I am posting this to demonstrate the kind of traps that people can fall into when trying to create a compressor without really understanding the theory of communication. I'm sure the experts here will get a grin out of this, it's worth a gander. This file contains a WORKING compressor which will pack random bytes to an entropy of 6 bits. Yes, it does work. Does it violate the "laws of compression" ? No. An explanation can be found at the bottom of this file. *********/ /*** C-Code for a Compressor: compressor & decompressor are the codec the Com_ routines are the generalized communication interace between the coder and the decoder main() is a stub for testing ***/ #include #include /*** protos **/ void Com_WriteBits(int val,int len); int Com_SizeOfInput(void); int Com_ReadBits(int len); /******* the codec *******/ int compressor( int b ) /* returns packed length */ { int curbase,numbits; curbase = 0; numbits = 0; for(;;) { if ( (b - curbase) < (1<