From: Ricardo Markiewicz Date: Fri, 25 Jun 2004 03:52:22 +0000 (+0000) Subject: Algunos bugfixes que daba problema con el signo y conversion de char a unsigned... X-Git-Tag: svn_import~64 X-Git-Url: https://git.llucax.com/z.facultad/75.06/jacu.git/commitdiff_plain/f4f9947b91b6b8d3ec18eb66639c8f2825a8dc4c Algunos bugfixes que daba problema con el signo y conversion de char a unsigned int (por el tema de como se completan los bits al estirar el numero!!) --- diff --git a/src/blocksorting/bs.c b/src/blocksorting/bs.c index d8bd093..ddd6aef 100644 --- a/src/blocksorting/bs.c +++ b/src/blocksorting/bs.c @@ -54,7 +54,6 @@ char es_menor(char *data, t_BlockSort *bs, int i, int j) } /* Son iguales! */ - /* Hack */ return 0; } @@ -118,6 +117,18 @@ void bs_solve(char *in, char *out, t_BlockSort *bs, Uint32 *k, Uint32 leido) bs->len = l; } +void print_v(t_BlockSortDecode *d, size_t len) +{ + size_t i; + + for(i=0; i %ld\n", salida, k); - bs_restore(orig, salida, k, i); - printf("Orig : %s\n", orig); + printf("BS : %ld ", k); + _print_(salida+8, i); + bs_restore(orig, salida+sizeof(Uint32)*2, k, i); + printf("Orig : "); + _print_(orig, i); } else fwrite(salida, 1, i, stdout); } diff --git a/src/mtf/mtf.c b/src/mtf/mtf.c index bdb423c..92088c0 100644 --- a/src/mtf/mtf.c +++ b/src/mtf/mtf.c @@ -3,7 +3,7 @@ /****privadas*****/ int no_pertenece(char *z, char c, int len); -void pop_front(char *z, int pos); +void pop_front(char *z, unsigned int pos); int get_pos(char *z, int len, char c); /****fin privadas******/ @@ -35,15 +35,16 @@ char *jacu_mtf(char *datos, int len, char **_z, int *z_len) return pos; } -char *jacu_mtf_inv(char *z, char *pos, int len) +char *jacu_mtf_inv(char *z, unsigned char *pos, int len) { char *datos; int i; datos = (char*)malloc(sizeof(char)*len); for(i=0; i 255) printf("pos > = %u\n", pos); + if (pos < 0u) printf("pos < = %d\n", pos); aux = z[pos]; for(i=pos; i>0; i--) z[i]=z[i-1]; diff --git a/src/mtf/mtf.h b/src/mtf/mtf.h index d313b55..c6f46ce 100644 --- a/src/mtf/mtf.h +++ b/src/mtf/mtf.h @@ -6,7 +6,7 @@ char *jacu_mtf(char *datos, int len, char **_z, int *z_len); -char *jacu_mtf_inv(char *z, char *pos, int len); +char *jacu_mtf_inv(char *z, unsigned char *pos, int len); char *jacu_buscar_z(char* datos, int len, int *size);