- shuff_encode_symbols(freqtable,codetable,inputfile,outputfile);
+ shuff_encode_symbols(freqtable,codetable,inputfile,outputfile,volsize);
+
+ /* Free up memory baby yeah */
+ free(freqtable);
+ free(inputlist);
+ free(codetable);
+
+ return 1;
+}
+
+SHUFFNODE *shuff_decode_symbols(SHUFFNODE *entrynode, unsigned long int buffer,
+ int *bitsleft, unsigned short int *symbol)
+{
+ char bit = 0;
+
+ /* Levanto el symbolo y si es uno valido, devuelvo */
+ *symbol = entrynode->symbol;
+ if (*symbol != 256) return entrynode;
+ if (*bitsleft == 0) return entrynode;
+
+ /* Obtengo otro bit a procesar y me muevo en el arbol */
+ bit = (buffer >> ((*bitsleft)-1)) & 1;
+ --(*bitsleft);
+ if (bit == 0) return shuff_decode_symbols(entrynode->lchild,buffer,bitsleft,symbol);
+ else return shuff_decode_symbols(entrynode->rchild,buffer,bitsleft,symbol);