summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2016-07-05 16:37:42 +0400
committerSergey Vojtovich <svoj@mariadb.org>2016-08-04 10:45:20 +0400
commit9c2215e022c325599bd1b66d1f2214529fb99a24 (patch)
tree03aff125ec9f83a01c813badc4988f821416c724 /mysys
parent86975e0492c03535271aea67e0b5e7e8fd0b1b78 (diff)
downloadmariadb-git-9c2215e022c325599bd1b66d1f2214529fb99a24.tar.gz
MDEV-9872 - Add common optimized CRC32 function interface
Move crc32-vpmsum to extra. Compile static crc32-vpmsum instead of adding sources directly. Make use of crc32-vpmsum via my_checksum(). Based on contribution by Daniel Black.
Diffstat (limited to 'mysys')
-rw-r--r--mysys/CMakeLists.txt2
-rw-r--r--mysys/checksum.c6
-rw-r--r--mysys/my_crc32.c23
3 files changed, 7 insertions, 24 deletions
diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt
index 0d404586569..5f4e9156fd2 100644
--- a/mysys/CMakeLists.txt
+++ b/mysys/CMakeLists.txt
@@ -71,7 +71,7 @@ ENDIF()
ADD_CONVENIENCE_LIBRARY(mysys ${MYSYS_SOURCES})
TARGET_LINK_LIBRARIES(mysys dbug strings mysys_ssl ${ZLIB_LIBRARY}
- ${LIBNSL} ${LIBM} ${LIBRT} ${LIBDL} ${LIBSOCKET} ${LIBEXECINFO})
+ ${LIBNSL} ${LIBM} ${LIBRT} ${LIBDL} ${LIBSOCKET} ${LIBEXECINFO} ${CRC32_VPMSUM_LIBRARY})
DTRACE_INSTRUMENT(mysys)
IF(HAVE_BFD_H)
diff --git a/mysys/checksum.c b/mysys/checksum.c
index a948785d935..7f26e02e7bd 100644
--- a/mysys/checksum.c
+++ b/mysys/checksum.c
@@ -30,7 +30,13 @@
ha_checksum my_checksum(ha_checksum crc, const uchar *pos, size_t length)
{
+#ifdef HAVE_CRC32_VPMSUM
+ extern unsigned int crc32_vpmsum(unsigned int crc, const unsigned char *p,
+ unsigned long len);
+ crc= (ha_checksum) crc32_vpmsum((uint) crc, pos, (uint) length);
+#else
crc= (ha_checksum) crc32((uint)crc, pos, (uint) length);
+#endif
DBUG_PRINT("info", ("crc: %lu", (ulong) crc));
return crc;
}
diff --git a/mysys/my_crc32.c b/mysys/my_crc32.c
deleted file mode 100644
index 0981c75755d..00000000000
--- a/mysys/my_crc32.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright (c) 2003, 2004 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-#include "mysys_priv.h"
-
-#ifndef HAVE_COMPRESS
-#undef DYNAMIC_CRC_TABLE
-#include "../zlib/crc32.c"
-#endif
-