mdbx: rework/fix unaligned access.

Change-Id: Ib0208e78786ac84551384ed57ac580fe0717840e
This commit is contained in:
Leonid Yuriev
2019-10-23 23:46:12 +03:00
parent b7d27c1b36
commit 81fd0beb1a
5 changed files with 620 additions and 548 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1273,11 +1273,13 @@ typedef struct MDBX_node {
uint32_t mn_dsize;
uint32_t mn_pgno32;
};
uint16_t mn_flags; /* see mdbx_node */
uint8_t mn_flags; /* see mdbx_node flags */
uint8_t mn_extra;
uint16_t mn_ksize; /* key size */
#else
uint16_t mn_ksize; /* key size */
uint16_t mn_flags; /* see mdbx_node */
uint8_t mn_extra;
uint8_t mn_flags; /* see mdbx_node flags */
union {
uint32_t mn_pgno32;
uint32_t mn_dsize;

View File

@@ -267,8 +267,11 @@ typedef pthread_mutex_t mdbx_fastmutex_t;
#endif /* all x86 */
#if !defined(MDBX_UNALIGNED_OK)
#if (defined(__ia32__) || defined(__e2k__) || \
defined(__ARM_FEATURE_UNALIGNED)) && \
#if defined(_MSC_VER)
#define MDBX_UNALIGNED_OK 1 /* avoid MSVC misoptimization */
#elif __CLANG_PREREQ(5, 0) || __GNUC_PREREQ(5, 0)
#define MDBX_UNALIGNED_OK 0 /* expecting optimization is well done */
#elif (defined(__ia32__) || defined(__ARM_FEATURE_UNALIGNED)) && \
!defined(__ALIGNED__)
#define MDBX_UNALIGNED_OK 1
#else