1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-05 13:16:09 +03:00

MDEV-21133: Introduce memmove_aligned()

Both variants of the InnoDB page directory are aligned to the entry size
(16 bits). Inform the compiler about it.
This commit is contained in:
Marko Mäkelä
2019-11-29 11:23:35 +02:00
parent 0f71e9e66b
commit 51a4260f00
3 changed files with 17 additions and 9 deletions

View File

@@ -210,6 +210,13 @@ inline void *memcpy_aligned(void *dest, const void *src, size_t n)
MY_ASSUME_ALIGNED(src, Alignment), n);
}
template <size_t Alignment>
inline void *memmove_aligned(void *dest, const void *src, size_t n)
{
static_assert(Alignment && !(Alignment & (Alignment - 1)), "power of 2");
return memmove(MY_ASSUME_ALIGNED(dest, Alignment),
MY_ASSUME_ALIGNED(src, Alignment), n);
}
template <size_t Alignment>
inline int memcmp_aligned(const void *s1, const void *s2, size_t n)
{
static_assert(Alignment && !(Alignment & (Alignment - 1)), "power of 2");