mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2024-11-23 09:59:42 +00:00
Move CRYPTOPP_POSIX_MEMALIGN_AVAILABLE preference down
This should result in fewer surprises
This commit is contained in:
parent
7141d026c1
commit
a876d82445
10
config.h
10
config.h
@ -694,14 +694,12 @@ NAMESPACE_END
|
||||
// posix_memalign see https://forum.kde.org/viewtopic.php?p=66274
|
||||
#if defined(_MSC_VER)
|
||||
#define CRYPTOPP_MM_MALLOC_AVAILABLE
|
||||
#elif defined(__APPLE__)
|
||||
#define CRYPTOPP_APPLE_MALLOC_AVAILABLE
|
||||
#elif (defined(_GNU_SOURCE) || ((_XOPEN_SOURCE + 0) >= 600)) && (_POSIX_ADVISORY_INFO > 0)
|
||||
#define CRYPTOPP_POSIX_MEMALIGN_AVAILABLE
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
|
||||
#define CRYPTOPP_MALLOC_ALIGNMENT_IS_16
|
||||
#elif defined(__linux__) || defined(__sun__) || defined(__CYGWIN__)
|
||||
#define CRYPTOPP_MEMALIGN_AVAILABLE
|
||||
#elif defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
|
||||
#define CRYPTOPP_MALLOC_ALIGNMENT_IS_16
|
||||
#elif (defined(_GNU_SOURCE) || ((_XOPEN_SOURCE + 0) >= 600)) && (_POSIX_ADVISORY_INFO > 0)
|
||||
#define CRYPTOPP_POSIX_MEMALIGN_AVAILABLE
|
||||
#else
|
||||
#define CRYPTOPP_NO_ALIGNED_ALLOC
|
||||
#endif
|
||||
|
8
misc.cpp
8
misc.cpp
@ -285,16 +285,14 @@ void CallNewHandler()
|
||||
void * AlignedAllocate(size_t size)
|
||||
{
|
||||
byte *p;
|
||||
#if defined(CRYPTOPP_APPLE_ALLOC_AVAILABLE)
|
||||
while ((p = (byte *)malloc(size)) == NULLPTR)
|
||||
#elif defined(CRYPTOPP_MM_MALLOC_AVAILABLE)
|
||||
#if defined(CRYPTOPP_MM_MALLOC_AVAILABLE)
|
||||
while ((p = (byte *)_mm_malloc(size, 16)) == NULLPTR)
|
||||
#elif defined(CRYPTOPP_POSIX_MEMALIGN_AVAILABLE)
|
||||
while (posix_memalign(reinterpret_cast<void**>(&p), 16, size) != 0)
|
||||
#elif defined(CRYPTOPP_MEMALIGN_AVAILABLE)
|
||||
while ((p = (byte *)memalign(16, size)) == NULLPTR)
|
||||
#elif defined(CRYPTOPP_MALLOC_ALIGNMENT_IS_16)
|
||||
while ((p = (byte *)malloc(size)) == NULLPTR)
|
||||
#elif defined(CRYPTOPP_POSIX_MEMALIGN_AVAILABLE)
|
||||
while (posix_memalign(reinterpret_cast<void**>(&p), 16, size) != 0)
|
||||
#else
|
||||
while ((p = (byte *)malloc(size + 16)) == NULLPTR)
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user