/* compress.pc - lrb - 3/22/2010 (pseudocode) compress [ open output file put "signature" byte FF in output array open input file read it into an array set nibble to 1 get byte from array while (bytes remain) [ determine byte's "class," i.e. "rare" or "common" if nibble = 1 [ if rare rtn1 else rtn2 ] else [ if rare rtn3 else rtn4 ] get byte from array ] if nibble = 2 [ /* note change! put HF in output array put CC in output array /* note change! ] else [ put FC in output array ] write output file from output array ] rtn1 [ put FH in output array where H is hex value of index of character in rare ] rtn2 [ save in H the hex value of index of character in common set nibble to 2 ] rtn3 [ put HF in output array save in H the hex value of index of character in rare /* note change! ] rtn4 [ put HK in output array where K is hex value of index of character in common /* note change! set nibble to 1 ]