From: Ricardo Markiewicz Date: Mon, 21 Jun 2004 23:33:52 +0000 (+0000) Subject: Para que quede mas prolijo X-Git-Tag: svn_import~94 X-Git-Url: https://git.llucax.com/z.facultad/75.06/jacu.git/commitdiff_plain/47449fb00cf570119b7c0392bbf8805805966bed?ds=sidebyside Para que quede mas prolijo --- diff --git a/src/blocksorting/bs.c b/src/blocksorting/bs.c index 9463b43..59a0de9 100644 --- a/src/blocksorting/bs.c +++ b/src/blocksorting/bs.c @@ -6,7 +6,7 @@ typedef struct _bs_decode_t_ { char c; - unsigned long int pos; + Uint32 pos; } t_BlockSortDecode; char es_menor(char *data, t_BlockSort *bs, int i, int j); @@ -31,7 +31,7 @@ int __compare(const void *d1, const void *d2) { char es_menor(char *data, t_BlockSort *bs, int i, int j) { - unsigned long int pi, pj, k; + Uint32 pi, pj, k; for(k=0; klen; k++) { pi = (i+k)%bs->len; @@ -61,9 +61,9 @@ void ordenar_array(char *data, t_BlockSort *bs) qsort(bs->array, bs->len, sizeof(t_BlockSortData), __compare); } -void print_(char *data, unsigned long int pos, unsigned long int len) +void print_(char *data, Uint32 pos, Uint32 len) { - unsigned long int i; + Uint32 i; for(i=0; ilen; i++) { @@ -87,7 +87,7 @@ int generar_salida(char *data, t_BlockSort *bs, char *salida) return k; } -void bs_solve(char *in, char *out, t_BlockSort *bs, unsigned long int *k, unsigned int leido) +void bs_solve(char *in, char *out, t_BlockSort *bs, Uint32 *k, Uint32 leido) { unsigned int l; l = bs->len; @@ -100,15 +100,15 @@ void bs_solve(char *in, char *out, t_BlockSort *bs, unsigned long int *k, unsign (*k) = generar_salida(in, bs, out); /* Guardo el k y el tamaño en el array */ - memcpy(out, &leido, sizeof(unsigned long int)); - memcpy(out+sizeof(unsigned long int), k, sizeof(unsigned long int)); + memcpy(out, &leido, sizeof(Uint32)); + memcpy(out+sizeof(Uint32), k, sizeof(Uint32)); bs->len = l; } -void bs_restore(char *dst, char *c, unsigned long int k, unsigned long int len) +void bs_restore(char *dst, char *c, Uint32 k, Uint32 len) { - unsigned long int i, current; + Uint32 i, current; t_BlockSortDecode *in; in = malloc(sizeof(t_BlockSortDecode)*len); @@ -129,7 +129,7 @@ void bs_restore(char *dst, char *c, unsigned long int k, unsigned long int len) free(in); } -t_BlockSort *bs_create(unsigned long int len) +t_BlockSort *bs_create(Uint32 len) { t_BlockSort *tmp; diff --git a/src/blocksorting/bs.h b/src/blocksorting/bs.h index 5097d6c..9efc1e5 100644 --- a/src/blocksorting/bs.h +++ b/src/blocksorting/bs.h @@ -6,11 +6,13 @@ #include #include +typedef unsigned long int Uint32; + typedef struct _bs_t_ t_BlockSort; typedef struct _bs_data_t_ { - unsigned long int pos_inicial; - unsigned long int pos_final; + Uint32 pos_inicial; + Uint32 pos_final; char ord; /* indica si esta ordenada */ /* Guardo el puntero al padre */ @@ -20,14 +22,15 @@ typedef struct _bs_data_t_ { struct _bs_t_ { char *data; t_BlockSortData *array; - unsigned long int len; + Uint32 len; }; + /** Inicializa un BlockSorting * * \param len Tamaño de página a utilizar */ -t_BlockSort *bs_create(unsigned long int len); +t_BlockSort *bs_create(Uint32 len); /** Libera un BlockSorting * @@ -42,7 +45,7 @@ void bs_destroy(t_BlockSort *bs); * \param k Puntero donde guardar la posicion del array original. * \oaram leido Tamaño de in (por si el tamaño de in es menor al de la pagina). */ -void bs_solve(char *in, char *out, t_BlockSort *bs, unsigned long int *k, unsigned int leido); +void bs_solve(char *in, char *out, t_BlockSort *bs, Uint32 *k, Uint32 leido); /** Obtiene el array original a partir de dst y k * @@ -51,7 +54,7 @@ void bs_solve(char *in, char *out, t_BlockSort *bs, unsigned long int *k, unsign * \param k Valor retornado por bs_solve. * \param len Tamaño de c */ -void bs_restore(char *dst, char *c, unsigned long int k, unsigned long int len); +void bs_restore(char *dst, char *c, Uint32 k, Uint32 len); #endif