aboutsummaryrefslogtreecommitdiffstats
path: root/wsutil
diff options
context:
space:
mode:
authorstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>2011-08-31 11:47:27 +0000
committerstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>2011-08-31 11:47:27 +0000
commit830f7978077048b20c2b88b5f6cf4a1c3aef7f56 (patch)
treedcba77617a427261533eace98c505c5cfc198a33 /wsutil
parent47860613400348191fbfc9690147c58283e5e90c (diff)
Make lookup functions for accessing crc32c_table and crc32_ccitt_table.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@38817 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'wsutil')
-rw-r--r--wsutil/crc32.c15
-rw-r--r--wsutil/crc32.h7
-rw-r--r--wsutil/libwsutil.def2
3 files changed, 16 insertions, 8 deletions
diff --git a/wsutil/crc32.c b/wsutil/crc32.c
index f01c5eb901..c0e05dc272 100644
--- a/wsutil/crc32.c
+++ b/wsutil/crc32.c
@@ -53,7 +53,7 @@
/* in the FTP archive "ftp.adelaide.edu.au/pub/rocksoft". */
/* */
/*****************************************************************/
-const guint32 crc32c_table[256] = {
+static const guint32 crc32c_table[256] = {
0x00000000L, 0xF26B8303L, 0xE13B70F7L, 0x1350F3F4L, 0xC79A971FL,
0x35F1141CL, 0x26A1E7E8L, 0xD4CA64EBL, 0x8AD958CFL, 0x78B2DBCCL,
0x6BE22838L, 0x9989AB3BL, 0x4D43CFD0L, 0xBF284CD3L, 0xAC78BF27L,
@@ -115,7 +115,7 @@ const guint32 crc32c_table[256] = {
* x^32 + x^26 + x^23 + x^22 + x^16 + x^12 + x^11 + x^8 + x^7 +
* x^5 + x^4 + x^2 + x + 1
*/
-const guint32 crc32_ccitt_table[256] = {
+static const guint32 crc32_ccitt_table[256] = {
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
@@ -170,6 +170,17 @@ const guint32 crc32_ccitt_table[256] = {
0x2d02ef8d
};
+guint32
+crc32c_table_lookup (guchar pos)
+{
+ return crc32_ccitt_table[pos];
+}
+
+guint32
+crc32_ccitt_table_lookup (guchar pos)
+{
+ return crc32_ccitt_table[pos];
+}
guint32
crc32c_calculate(const void *buf, int len, guint32 crc)
diff --git a/wsutil/crc32.h b/wsutil/crc32.h
index f69dba6ebf..d77a9d64cf 100644
--- a/wsutil/crc32.h
+++ b/wsutil/crc32.h
@@ -41,9 +41,10 @@ extern "C" {
((crc32c_value & 0x0000ff00) << 8) | \
((crc32c_value & 0x000000ff) << 24))
-#define CRC32C(c,d) (c=(c>>8)^crc32c_table[(c^(d))&0xFF])
+#define CRC32C(c,d) (c=(c>>8)^crc32c_table_lookup((c^(d))&0xFF))
-WS_VAR_IMPORT const guint32 crc32c_table[256];
+guint32 crc32c_table_lookup (guchar pos);
+guint32 crc32_ccitt_table_lookup (guchar pos);
/** Compute CRC32C checksum of a buffer of data.
@param buf The buffer containing the data.
@@ -52,8 +53,6 @@ WS_VAR_IMPORT const guint32 crc32c_table[256];
@return The CRC32C checksum. */
extern guint32 crc32c_calculate(const void *buf, int len, guint32 crc);
-WS_VAR_IMPORT const guint32 crc32_ccitt_table[256];
-
/** Compute CRC32 CCITT checksum of a buffer of data.
@param buf The buffer containing the data.
@param len The number of bytes to include in the computation.
diff --git a/wsutil/libwsutil.def b/wsutil/libwsutil.def
index d092e25ff4..9ccc2561b4 100644
--- a/wsutil/libwsutil.def
+++ b/wsutil/libwsutil.def
@@ -26,9 +26,7 @@ crc16_plain_update
; crc32.c
crc32_ccitt
crc32_ccitt_seed
-crc32_ccitt_table DATA
crc32c_calculate
-crc32c_table DATA
; crcdrm.c
crc_drm