Commit 84ee7a10 authored by Sergey Vojtovich's avatar Sergey Vojtovich

Less code to depend on ut_crc32_init()

parent aaf5ee85
...@@ -51,6 +51,7 @@ extern ut_crc32_func_t ut_crc32; ...@@ -51,6 +51,7 @@ extern ut_crc32_func_t ut_crc32;
when converting byte strings to integers internally. */ when converting byte strings to integers internally. */
extern uint32_t ut_crc32_legacy_big_endian(const byte* buf, ulint len); extern uint32_t ut_crc32_legacy_big_endian(const byte* buf, ulint len);
/** Text description of CRC32 implementation */
extern const char* ut_crc32_implementation; extern const char* ut_crc32_implementation;
#endif /* ut0crc32_h */ #endif /* ut0crc32_h */
...@@ -86,12 +86,6 @@ mysys/my_perf.c, contributed by Facebook under the following license. ...@@ -86,12 +86,6 @@ mysys/my_perf.c, contributed by Facebook under the following license.
#include "univ.i" #include "univ.i"
#include "ut0crc32.h" #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. /** Swap the byte order of an 8 byte integer.
@param[in] i 8-byte integer @param[in] i 8-byte integer
@return 8-byte integer */ @return 8-byte integer */
...@@ -125,6 +119,13 @@ ut_crc32_power8( ...@@ -125,6 +119,13 @@ ut_crc32_power8(
{ {
return crc32c_vpmsum(0, buf, len); 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 #endif
#if defined(__GNUC__) && defined(__x86_64__) #if defined(__GNUC__) && defined(__x86_64__)
...@@ -568,8 +569,6 @@ ut_crc32_init() ...@@ -568,8 +569,6 @@ ut_crc32_init()
/*===========*/ /*===========*/
{ {
ut_crc32_slice8_table_init(); ut_crc32_slice8_table_init();
ut_crc32 = ut_crc32_sw;
ut_crc32_implementation = "Using generic crc32 instructions";
#if defined(__GNUC__) && defined(__x86_64__) #if defined(__GNUC__) && defined(__x86_64__)
uint32_t vend[3]; uint32_t vend[3];
...@@ -603,10 +602,5 @@ ut_crc32_init() ...@@ -603,10 +602,5 @@ ut_crc32_init()
ut_crc32 = ut_crc32_hw; ut_crc32 = ut_crc32_hw;
ut_crc32_implementation = "Using SSE2 crc32 instructions"; 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 #endif
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment