summaryrefslogtreecommitdiffstats
path: root/src/H5Zfletcher32.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-08-21 14:44:30 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-08-21 14:44:30 (GMT)
commit16897c2d2a62bd4e77b26f301cfc5e1a4e721ce8 (patch)
tree5dfa3806a20725ebb60dba3b06e4fd26cecce8df /src/H5Zfletcher32.c
parent5a7ef381b26985886a88ad88b2afda703b578d24 (diff)
downloadhdf5-16897c2d2a62bd4e77b26f301cfc5e1a4e721ce8.zip
hdf5-16897c2d2a62bd4e77b26f301cfc5e1a4e721ce8.tar.gz
hdf5-16897c2d2a62bd4e77b26f301cfc5e1a4e721ce8.tar.bz2
[svn-r12600] Description:
Clean up code a bit by reformatting and using portable macros for direct C library calls. Tested On: FreeBSD/32 4.11 (sleipnir) Linux/32 2.4 (heping) Linux/64 2.4 (mir) Solaris/64 2.9 (shanti)
Diffstat (limited to 'src/H5Zfletcher32.c')
-rw-r--r--src/H5Zfletcher32.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/H5Zfletcher32.c b/src/H5Zfletcher32.c
index b0c120a..770d05a 100644
--- a/src/H5Zfletcher32.c
+++ b/src/H5Zfletcher32.c
@@ -64,13 +64,10 @@ const H5Z_class_t H5Z_FLETCHER32[1] = {{
*
*-------------------------------------------------------------------------
*/
-
static uint32_t
H5Z_filter_fletcher32_compute(void *_src, size_t len)
{
unsigned char *src=(unsigned char *)_src;
- /*To handle unusual platforms like Cray*/
- unsigned short tmp_src;
size_t count = len; /* Number of bytes left to checksum */
uint32_t s1 = 0, s2 = 0; /* Temporary partial checksums */
@@ -78,8 +75,8 @@ H5Z_filter_fletcher32_compute(void *_src, size_t len)
/* Compute checksum */
while(count > 1) {
+ unsigned short tmp_src; /*To handle unusual platforms like Cray*/
- /*To handle unusual platforms like Cray*/
tmp_src = (((unsigned short)src[0])<<8) | ((unsigned short)src[1]);
src +=2;
s1 += tmp_src;
@@ -96,6 +93,7 @@ H5Z_filter_fletcher32_compute(void *_src, size_t len)
count -= 2;
}
+ /* Check for single byte remaining */
if(count==1) {
s1 += *(unsigned char*)src;
if(s1 & 0xFFFF0000) { /*Wrap around carry if occurred*/