X-Git-Url: https://git.llucax.com/z.facultad/75.06/jacu.git/blobdiff_plain/1e857d6dff5bd9eadd7b59a2deb323eb5d644ccf..92acf059b083a5874172215f13c94c4071536b22:/src/jacu.c diff --git a/src/jacu.c b/src/jacu.c index ba8daf1..dd18485 100644 --- a/src/jacu.c +++ b/src/jacu.c @@ -96,7 +96,7 @@ int main(int argc, char* argv[]) data = malloc(sizeof(char)*pagesize); /* Reservo lugar tambien para guardar el k y el tamaño */ - salida = malloc(sizeof(char)*(pagesize)+sizeof(Uint32)*2); + salida = malloc(sizeof(char)*pagesize+sizeof(Uint32)*2); bs = bs_create(pagesize); fp = fopen(argv[optind], "rb"); @@ -115,9 +115,27 @@ int main(int argc, char* argv[]) /* Hago el BS */ bs_solve(data, salida, bs, &k, i); + printf("BS k=%ld\n", *(Uint32 *)(salida+sizeof(Uint32))); + printf("PageSize = %ld\n", *(Uint32 *)salida); + + printf("Antes de MTF = %ld [", i); + { + int ii; + for(ii=0; ii<(i+sizeof(Uint32)); ii++) + printf("(%c)", salida[ii+sizeof(Uint32)]); + printf("]\n"); + } /* Le aplico el MTF, salteo el tamaño del bloque para que no se pierda. */ mtf = jacu_mtf(salida+sizeof(Uint32), i+sizeof(Uint32), &z, &z_len); + printf("MTF Z (len=%d) = [", z_len); + { + int ii; + for(ii=0; ii 0) { block = malloc(block_size*sizeof(char)+sizeof(Uint32)); orig = malloc(block_size*sizeof(char)); - fread(block, block_size, sizeof(char), fp_in); + fread(block, block_size+sizeof(Uint32), sizeof(char), fp_in); + printf("Antes MTF_inv = ["); + { + int ii; + for(ii=0; ii