Move CRYPTOPP_POSIX_MEMALIGN_AVAILABLE preference down
This should result in fewer surprisespull/580/merge
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
|
// posix_memalign see https://forum.kde.org/viewtopic.php?p=66274
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#define CRYPTOPP_MM_MALLOC_AVAILABLE
|
#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__)
|
#elif defined(__linux__) || defined(__sun__) || defined(__CYGWIN__)
|
||||||
#define CRYPTOPP_MEMALIGN_AVAILABLE
|
#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
|
#else
|
||||||
#define CRYPTOPP_NO_ALIGNED_ALLOC
|
#define CRYPTOPP_NO_ALIGNED_ALLOC
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
8
misc.cpp
8
misc.cpp
|
|
@ -285,16 +285,14 @@ void CallNewHandler()
|
||||||
void * AlignedAllocate(size_t size)
|
void * AlignedAllocate(size_t size)
|
||||||
{
|
{
|
||||||
byte *p;
|
byte *p;
|
||||||
#if defined(CRYPTOPP_APPLE_ALLOC_AVAILABLE)
|
#if defined(CRYPTOPP_MM_MALLOC_AVAILABLE)
|
||||||
while ((p = (byte *)malloc(size)) == NULLPTR)
|
|
||||||
#elif defined(CRYPTOPP_MM_MALLOC_AVAILABLE)
|
|
||||||
while ((p = (byte *)_mm_malloc(size, 16)) == NULLPTR)
|
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)
|
#elif defined(CRYPTOPP_MEMALIGN_AVAILABLE)
|
||||||
while ((p = (byte *)memalign(16, size)) == NULLPTR)
|
while ((p = (byte *)memalign(16, size)) == NULLPTR)
|
||||||
#elif defined(CRYPTOPP_MALLOC_ALIGNMENT_IS_16)
|
#elif defined(CRYPTOPP_MALLOC_ALIGNMENT_IS_16)
|
||||||
while ((p = (byte *)malloc(size)) == NULLPTR)
|
while ((p = (byte *)malloc(size)) == NULLPTR)
|
||||||
|
#elif defined(CRYPTOPP_POSIX_MEMALIGN_AVAILABLE)
|
||||||
|
while (posix_memalign(reinterpret_cast<void**>(&p), 16, size) != 0)
|
||||||
#else
|
#else
|
||||||
while ((p = (byte *)malloc(size + 16)) == NULLPTR)
|
while ((p = (byte *)malloc(size + 16)) == NULLPTR)
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue