diff options
author | Daniel Black <daniel@linux.ibm.com> | 2020-03-16 20:52:21 +1100 |
---|---|---|
committer | Daniel Black <daniel@linux.ibm.com> | 2020-03-17 11:07:38 +1100 |
commit | c6db115ce66a8c7ec78343feebab2286d431bc24 (patch) | |
tree | 8447b066b743da72a735d00f63ba6ff7fbf8f316 | |
parent | 9bd583ce1f313491018b83290452ac28674093d3 (diff) | |
download | mariadb-git-c6db115ce66a8c7ec78343feebab2286d431bc24.tar.gz |
Fix compile on all big endian related to innodb:ut_crc32_swap_byteorder
Move function ut_crc32_swap_byteorder to a non-x86 #ifdef area.
As its only used in BIGENDIAN, use #ifdefs around
ut_crc32_swap_byteorder.
Travis CI and Debian both include s390x in builds/test, which is big endian.
Fixes commit: 1312b4ebb652
-rw-r--r-- | storage/innobase/ut/ut0crc32.cc | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/storage/innobase/ut/ut0crc32.cc b/storage/innobase/ut/ut0crc32.cc index 3de51217d03..efe6dc0a729 100644 --- a/storage/innobase/ut/ut0crc32.cc +++ b/storage/innobase/ut/ut0crc32.cc @@ -215,21 +215,6 @@ ut_crc32_64_low_hw( return(static_cast<uint32_t>(crc_64bit)); } -/** Swap the byte order of an 8 byte integer. -@param[in] i 8-byte integer -@return 8-byte integer */ -inline uint64_t ut_crc32_swap_byteorder(uint64_t i) -{ - return i << 56 | - (i & 0x000000000000FF00ULL) << 40 | - (i & 0x0000000000FF0000ULL) << 24 | - (i & 0x00000000FF000000ULL) << 8 | - (i & 0x000000FF00000000ULL) >> 8 | - (i & 0x0000FF0000000000ULL) >> 24 | - (i & 0x00FF000000000000ULL) >> 40 | - i >> 56; -} - /** Calculate CRC32 over 64-bit byte string using a hardware/CPU instruction. @param[in,out] crc crc32 checksum so far when this function is called, when the function ends it will contain the new checksum @@ -405,6 +390,23 @@ ut_crc32_8_sw( (*len)--; } +/** Swap the byte order of an 8 byte integer. +@param[in] i 8-byte integer +@return 8-byte integer */ +# ifdef WORDS_BIGENDIAN +inline uint64_t ut_crc32_swap_byteorder(uint64_t i) +{ + return i << 56 | + (i & 0x000000000000FF00ULL) << 40 | + (i & 0x0000000000FF0000ULL) << 24 | + (i & 0x00000000FF000000ULL) << 8 | + (i & 0x000000FF00000000ULL) >> 8 | + (i & 0x0000FF0000000000ULL) >> 24 | + (i & 0x00FF000000000000ULL) >> 40 | + i >> 56; +} +# endif /* WORDS_BIGENDIAN */ + /** Calculate CRC32 over a 64-bit integer using a software implementation. @param[in] crc crc32 checksum so far @param[in] data data to be checksummed |