Thanks, this looks OK to me. I guess the function ut_crc32_init() will be made optional separately.

On Thu, Nov 23, 2017 at 1:22 PM, Sergey Vojtovich <svoj@mariadb.org> wrote:
revision-id: 14bd406970c9bb18c744a452359aa4505f325b2d (mariadb-10.3.2-67-g14bd406)
parent(s): f28af027a0439d760c6d26eb67a932e97eb665d7
committer: Sergey Vojtovich
timestamp: 2017-11-23 15:22:10 +0400
message:

Less code to depend on ut_crc32_init()

---
 storage/innobase/include/ut0crc32.h |  1 +
 storage/innobase/ut/ut0crc32.cc     | 20 +++++++-------------
 2 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/storage/innobase/include/ut0crc32.h b/storage/innobase/include/ut0crc32.h
index 527a3e81..32ad066 100644
--- a/storage/innobase/include/ut0crc32.h
+++ b/storage/innobase/include/ut0crc32.h
@@ -51,6 +51,7 @@ extern ut_crc32_func_t        ut_crc32;
 when converting byte strings to integers internally. */
 extern uint32_t ut_crc32_legacy_big_endian(const byte* buf, ulint len);

+/** Text description of CRC32 implementation */
 extern const char*     ut_crc32_implementation;

 #endif /* ut0crc32_h */
diff --git a/storage/innobase/ut/ut0crc32.cc b/storage/innobase/ut/ut0crc32.cc
index 36c52b7..48f6b82 100644
--- a/storage/innobase/ut/ut0crc32.cc
+++ b/storage/innobase/ut/ut0crc32.cc
@@ -86,12 +86,6 @@ mysys/my_perf.c, contributed by Facebook under the following license.
 #include "univ.i"
 #include "ut0crc32.h"

-/** Pointer to CRC32 calculation function. */
-ut_crc32_func_t        ut_crc32;
-
-/** Text description of CRC32 implementation */
-const char*    ut_crc32_implementation;
-
 /** Swap the byte order of an 8 byte integer.
 @param[in]     i       8-byte integer
 @return 8-byte integer */
@@ -125,6 +119,13 @@ ut_crc32_power8(
 {
        return crc32c_vpmsum(0, buf, len);
 }
+
+ut_crc32_func_t        ut_crc32 = ut_crc32_power8;
+const char*    ut_crc32_implementation = "Using POWER8 crc32 instructions";
+#else
+uint32_t ut_crc32_sw(const byte* buf, ulint len);
+ut_crc32_func_t        ut_crc32 = ut_crc32_sw;
+const char*    ut_crc32_implementation = "Using generic crc32 instructions";
 #endif

 #if defined(__GNUC__) && defined(__x86_64__)
@@ -568,8 +569,6 @@ ut_crc32_init()
 /*===========*/
 {
        ut_crc32_slice8_table_init();
-       ut_crc32 = ut_crc32_sw;
-       ut_crc32_implementation = "Using generic crc32 instructions";

 #if defined(__GNUC__) && defined(__x86_64__)
        uint32_t        vend[3];
@@ -603,10 +602,5 @@ ut_crc32_init()
                ut_crc32 = ut_crc32_hw;
                ut_crc32_implementation = "Using SSE2 crc32 instructions";
        }
-
-#elif defined(HAVE_CRC32_VPMSUM)
-       ut_crc32 = ut_crc32_power8;
-       ut_crc32_implementation = "Using POWER8 crc32 instructions";
 #endif
-
 }
_______________________________________________
commits mailing list
commits@mariadb.org
https://lists.askmonty.org/cgi-bin/mailman/listinfo/commits



--
Marko Mäkelä, Lead Developer InnoDB
MariaDB Corporation

DON’T MISS

M|18

MariaDB User Conference  

February 26 - 27, 2018

New York City

https://m18.mariadb.com/