diff options
author | Magnus Lundborg <lundborg.magnus@gmail.com> | 2014-07-21 13:56:54 (GMT) |
---|---|---|
committer | Magnus Lundborg <lundborg.magnus@gmail.com> | 2014-07-23 22:17:52 (GMT) |
commit | 1a09f345860834fb1c2005e65948fa296b201e8b (patch) | |
tree | fb25ea8a08d34fa2ca2298792ef8e559841932a7 /src/compression/mtf.c | |
parent | 3e2c4306bba827d5b1d3444d5fb9a81e4b2a88bb (diff) |
Improved TNG compression speed.
Change-Id: I71c66c6b534cb402048dcd75e008d3db4bd3fb71
Diffstat (limited to 'src/compression/mtf.c')
-rw-r--r-- | src/compression/mtf.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/compression/mtf.c b/src/compression/mtf.c index d6eaf30..bfb0e19 100644 --- a/src/compression/mtf.c +++ b/src/compression/mtf.c @@ -1,7 +1,7 @@ /* This code is part of the tng compression routines. * - * Written by Daniel Spangberg - * Copyright (c) 2010, 2013, The GROMACS development team. + * Written by Daniel Spangberg and Magnus Lundborg + * Copyright (c) 2010, 2013-2014 The GROMACS development team. * * * This program is free software; you can redistribute it and/or @@ -10,6 +10,7 @@ #include <stdlib.h> +#include <string.h> #include "../../include/compression/warnmalloc.h" #include "../../include/compression/mtf.h" @@ -63,8 +64,9 @@ void Ptngc_comp_conv_to_mtf_partial(unsigned int *vals, int nvals, { unsigned char *tmp=warnmalloc(nvals*2); int i, j; - for (i=0; i<nvals; i++) - valsmtf[i]=0U; + + memset(valsmtf, 0U, sizeof(unsigned int) * nvals); + for (j=0; j<3; j++) { for (i=0; i<nvals; i++) @@ -138,8 +140,9 @@ void Ptngc_comp_conv_from_mtf_partial(unsigned int *valsmtf, int nvals, { unsigned char *tmp=warnmalloc(nvals*2); int i, j; - for (i=0; i<nvals; i++) - vals[i]=0U; + + memset(vals, 0U, sizeof(unsigned int) * nvals); + for (j=0; j<3; j++) { for (i=0; i<nvals; i++) @@ -156,8 +159,9 @@ void Ptngc_comp_conv_from_mtf_partial3(unsigned char *valsmtf, int nvals, { unsigned char *tmp=warnmalloc(nvals); int i, j; - for (i=0; i<nvals; i++) - vals[i]=0U; + + memset(vals, 0U, sizeof(unsigned int) * nvals); + for (j=0; j<3; j++) { comp_conv_from_mtf_byte(valsmtf+j*nvals,nvals,tmp); |