summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-09-12 15:25:35 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-09-12 15:25:35 (GMT)
commitd3a12e1058e9afcb77b265a88690f1d3d5190fd7 (patch)
tree407aafe3aa82cbebd081f14ac042f869eb25e553 /test
parent314b3f597b0656820598ab89295af96fea24fd63 (diff)
downloadhdf5-d3a12e1058e9afcb77b265a88690f1d3d5190fd7.zip
hdf5-d3a12e1058e9afcb77b265a88690f1d3d5190fd7.tar.gz
hdf5-d3a12e1058e9afcb77b265a88690f1d3d5190fd7.tar.bz2
[svn-r12661] Description:
Add 'loookup3' checksum routine and switch to using it for metadata checksums - it's just as "strong" as the CRC32 and about 40% faster in general (with some compiler optimizations, it's nearly as fast as the fletcher-32 algorithm). Tested on: Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2)
Diffstat (limited to 'test')
-rw-r--r--test/tchecksum.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/tchecksum.c b/test/tchecksum.c
index ee492f8..4c860b7 100644
--- a/test/tchecksum.c
+++ b/test/tchecksum.c
@@ -57,6 +57,9 @@ test_chksum_size_one(void)
chksum = H5_checksum_crc(buf, sizeof(buf));
VERIFY(chksum, 0xfa2568b7, "H5_checksum_crc");
+ chksum = H5_checksum_lookup3(buf, sizeof(buf));
+ VERIFY(chksum, 0xa209c931, "H5_checksum_lookup3");
+
/* Buffer w/zero(s) for data */
HDmemset(buf, 0, sizeof(buf));
chksum = H5_checksum_fletcher32(buf, sizeof(buf));
@@ -64,6 +67,9 @@ test_chksum_size_one(void)
chksum = H5_checksum_crc(buf, sizeof(buf));
VERIFY(chksum, 0xfa60fb57, "H5_checksum_crc");
+
+ chksum = H5_checksum_lookup3(buf, sizeof(buf));
+ VERIFY(chksum, 0x8ba9414b, "H5_checksum_lookup3");
} /* test_chksum_size_one() */
@@ -85,6 +91,9 @@ test_chksum_size_two(void)
chksum = H5_checksum_crc(buf, sizeof(buf));
VERIFY(chksum, 0xfc856608, "H5_checksum_crc");
+ chksum = H5_checksum_lookup3(buf, sizeof(buf));
+ VERIFY(chksum, 0x8ba7a6c9, "H5_checksum_lookup3");
+
/* Buffer w/zero(s) for data */
HDmemset(buf, 0, sizeof(buf));
chksum = H5_checksum_fletcher32(buf, sizeof(buf));
@@ -92,6 +101,9 @@ test_chksum_size_two(void)
chksum = H5_checksum_crc(buf, sizeof(buf));
VERIFY(chksum, 0xfc7e9b20, "H5_checksum_crc");
+
+ chksum = H5_checksum_lookup3(buf, sizeof(buf));
+ VERIFY(chksum, 0x62cd61b3, "H5_checksum_lookup3");
} /* test_chksum_size_two() */
@@ -113,6 +125,9 @@ test_chksum_size_three(void)
chksum = H5_checksum_crc(buf, sizeof(buf));
VERIFY(chksum, 0xfebc5d70, "H5_checksum_crc");
+ chksum = H5_checksum_lookup3(buf, sizeof(buf));
+ VERIFY(chksum, 0xcebdf4f0, "H5_checksum_lookup3");
+
/* Buffer w/zero(s) for data */
HDmemset(buf, 0, sizeof(buf));
chksum = H5_checksum_fletcher32(buf, sizeof(buf));
@@ -120,6 +135,9 @@ test_chksum_size_three(void)
chksum = H5_checksum_crc(buf, sizeof(buf));
VERIFY(chksum, 0xf9cc4c7a, "H5_checksum_crc");
+
+ chksum = H5_checksum_lookup3(buf, sizeof(buf));
+ VERIFY(chksum, 0x6bd0060f, "H5_checksum_lookup3");
} /* test_chksum_size_three() */
@@ -141,6 +159,9 @@ test_chksum_size_four(void)
chksum = H5_checksum_crc(buf, sizeof(buf));
VERIFY(chksum, 0xff398a46, "H5_checksum_crc");
+ chksum = H5_checksum_lookup3(buf, sizeof(buf));
+ VERIFY(chksum, 0x2c88bb51, "H5_checksum_lookup3");
+
/* Buffer w/zero(s) for data */
HDmemset(buf, 0, sizeof(buf));
chksum = H5_checksum_fletcher32(buf, sizeof(buf));
@@ -148,6 +169,9 @@ test_chksum_size_four(void)
chksum = H5_checksum_crc(buf, sizeof(buf));
VERIFY(chksum, 0xff117081, "H5_checksum_crc");
+
+ chksum = H5_checksum_lookup3(buf, sizeof(buf));
+ VERIFY(chksum, 0x049396b8, "H5_checksum_lookup3");
} /* test_chksum_size_four() */
@@ -173,6 +197,9 @@ test_chksum_large(void)
chksum = H5_checksum_crc(large_buf, sizeof(large_buf));
VERIFY(chksum, 0xfbd0f7c0, "H5_checksum_crc");
+ chksum = H5_checksum_lookup3(large_buf, sizeof(large_buf));
+ VERIFY(chksum, 0x1bd2ee7b, "H5_checksum_lookup3");
+
/* Buffer w/zero(s) for data */
HDmemset(large_buf, 0, sizeof(large_buf));
chksum = H5_checksum_fletcher32(large_buf, sizeof(large_buf));
@@ -180,6 +207,9 @@ test_chksum_large(void)
chksum = H5_checksum_crc(large_buf, sizeof(large_buf));
VERIFY(chksum, 0xfac8b4c4, "H5_checksum_crc");
+
+ chksum = H5_checksum_lookup3(large_buf, sizeof(large_buf));
+ VERIFY(chksum, 0x930c7afc, "H5_checksum_lookup3");
} /* test_chksum_large() */