summaryrefslogtreecommitdiff
path: root/storage/innobase/include/mach0data.h
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/include/mach0data.h')
-rw-r--r--storage/innobase/include/mach0data.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/storage/innobase/include/mach0data.h b/storage/innobase/include/mach0data.h
index 3d0e48253eb..7b776759a67 100644
--- a/storage/innobase/include/mach0data.h
+++ b/storage/innobase/include/mach0data.h
@@ -315,6 +315,28 @@ mach_read_from_n_little_endian(
const byte* buf, /*!< in: from where to read */
ulint buf_size) /*!< in: from how many bytes to read */
MY_ATTRIBUTE((warn_unused_result));
+
+
+/** Reads a 64 bit stored in big endian format
+@param buf From where to read
+@return uint64_t */
+UNIV_INLINE
+uint64_t
+mach_read_uint64_little_endian(const byte* buf)
+{
+#ifdef WORDS_BIGENDIAN
+ return
+ uint64_t(buf[0]) | uint64_t(buf[1]) << 8 |
+ uint64_t(buf[2]) << 16 | uint64_t(buf[3]) << 24 |
+ uint64_t(buf[4]) << 32 | uint64_t(buf[5]) << 40 |
+ uint64_t(buf[6]) << 48 | uint64_t(buf[7]) << 56;
+#else
+ uint64_t n;
+ memcpy(&n, buf, sizeof(uint64_t));
+ return n;
+#endif
+}
+
/*********************************************************//**
Writes a ulint in the little-endian format. */
UNIV_INLINE