diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2003-02-04 18:50:56 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2003-02-04 18:50:56 (GMT) |
commit | 3879dcce1b831fd553ff15256661ca7cc23ca70d (patch) | |
tree | f4a6ed3b08b7ac2926b396f497fdd62faf35bb6c /src/H5Zshuffle.c | |
parent | 092a41fe51ea58ab388d5f5d577f7d4a16a1f5b8 (diff) | |
download | hdf5-3879dcce1b831fd553ff15256661ca7cc23ca70d.zip hdf5-3879dcce1b831fd553ff15256661ca7cc23ca70d.tar.gz hdf5-3879dcce1b831fd553ff15256661ca7cc23ca70d.tar.bz2 |
[svn-r6375]
Purpose:
New feature
Description:
Added Adler32 checksum as a filter in pipeline
Platforms tested:
arabica (fortran), eirene (, C++), modi4 (parallel, fortran)
Misc. update:
Update release_docs/RELEASE.
Diffstat (limited to 'src/H5Zshuffle.c')
-rw-r--r-- | src/H5Zshuffle.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/H5Zshuffle.c b/src/H5Zshuffle.c index f25b5ff..a33d3cd 100644 --- a/src/H5Zshuffle.c +++ b/src/H5Zshuffle.c @@ -42,9 +42,8 @@ static int interface_initialize_g = 0; *------------------------------------------------------------------------- */ size_t -H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, - const unsigned cd_values[], size_t nbytes, - size_t *buf_size, void **buf) +H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], + size_t nbytes, size_t *buf_size, void **buf) { void *dest = NULL; /* Buffer to deposit [un]shuffled bytes into */ unsigned char *_src; /* Alias for source buffer */ @@ -52,6 +51,7 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, unsigned bytesoftype; /* Number of bytes per element */ size_t numofelements; /* Number of elements in buffer */ size_t i,j; /* Local index variables */ + size_t leftover; /* Extra bytes at end of buffer */ size_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5Z_filter_shuffle, 0); @@ -68,6 +68,9 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, /* Compute the number of elements in buffer */ numofelements=nbytes/bytesoftype; + /* Compute the leftover bytes if there are any */ + leftover = nbytes%bytesoftype; + /* Allocate the destination buffer */ if (NULL==(dest = H5MM_malloc(nbytes))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for shuffle buffer"); @@ -84,6 +87,13 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, _dest+=bytesoftype; } /* end for */ } /* end for */ + + /* Add leftover to the end of data */ + if(leftover>0) { + /* Adjust back to end of shuffled bytes */ + _dest -= (bytesoftype - 1); + HDmemcpy((void*)_dest, (void*)_src, leftover); + } } /* end if */ else { /* Get the pointer to the destination buffer */ @@ -97,6 +107,13 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, _src+=bytesoftype; } /* end for */ } /* end for */ + + /* Add leftover to the end of data */ + if(leftover>0) { + /* Adjust back to end of shuffled bytes */ + _src -= (bytesoftype - 1); + HDmemcpy((void*)_dest, (void*)_src, leftover); + } } /* end else */ /* Set the buffer information to return */ |