From: Ricardo Markiewicz Date: Mon, 21 Jun 2004 02:04:37 +0000 (+0000) Subject: * Guardo el k en el array de salida del BS para que el MTF lo tenga en cuenta. X-Git-Tag: svn_import~109 X-Git-Url: https://git.llucax.com/z.facultad/75.06/jacu.git/commitdiff_plain/0aa658449bef68a63ecc6ba2960f93810a8a8341?ds=sidebyside * Guardo el k en el array de salida del BS para que el MTF lo tenga en cuenta. --- diff --git a/src/blocksorting/bs.c b/src/blocksorting/bs.c index 21e1ff6..7f8cb83 100644 --- a/src/blocksorting/bs.c +++ b/src/blocksorting/bs.c @@ -1,5 +1,6 @@ #include "bs.h" +#include /* Block Sorting Optimizado en memoria! */ @@ -93,6 +94,9 @@ void bs_solve(char *in, char *out, t_BlockSort *bs, unsigned long int *k, unsign ordenar_array(in, bs); (*k) = generar_salida(in, bs, out); + /* Guardo el k en el array */ + memcpy(out+leido, k, sizeof(unsigned long int)); + bs->len = l; } diff --git a/src/jacu.c b/src/jacu.c index 8c6a210..2982b0f 100644 --- a/src/jacu.c +++ b/src/jacu.c @@ -2,6 +2,7 @@ #include "statichuff/statichuff.h" #include "blocksorting/bs.h" #include "mtf/mtf.h" +#include "vfile/vfile.h" #include #include #include @@ -60,7 +61,8 @@ int main(int argc, char* argv[]) int *mtf; char *salida, *data, c; data = malloc(sizeof(char)*pagesize); - salida = malloc(sizeof(char)*(pagesize)); + /* Reservo lugar tambien para guardar el k */ + salida = malloc(sizeof(char)*(pagesize)+sizeof(unsigned long int)); bs = bs_create(pagesize); fp = fopen(argv[optind], "rb"); fp_out = fopen("tmp.comp", "wb"); @@ -76,14 +78,14 @@ int main(int argc, char* argv[]) /* Hago el BS */ bs_solve(data, salida, bs, &k, i); /* Le aplico el MTF */ - mtf = jacu_mtf(salida, i); + mtf = jacu_mtf(salida, i+sizeof(unsigned long int)); for(j=0; j