Fix unwanted inlining of factory.h classes on AIX and Power7
Enable aligned allocations under IBM XL C/C++. Based on the AIX malloc man pages, "... the block is aligned so that it can be used for any type of data". Previously CRYPTOPP_NO_ALIGNED_ALLOC was in effect. Use malloc instead of calloc on OS X. Based on the OS X malloc man pages, "... the allocated memory is aligned such that it can be used for any data type, including AltiVec- and SSE-related types". Additionally, calloc zero'd the memory it allocated which slowed things down on Apple systems.pull/531/head
parent
437eda09e0
commit
1315c1fe2f
7
config.h
7
config.h
|
|
@ -637,7 +637,7 @@ NAMESPACE_END
|
||||||
#define CRYPTOPP_MM_MALLOC_AVAILABLE
|
#define CRYPTOPP_MM_MALLOC_AVAILABLE
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
#define CRYPTOPP_APPLE_MALLOC_AVAILABLE
|
#define CRYPTOPP_APPLE_MALLOC_AVAILABLE
|
||||||
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
|
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(_AIX)
|
||||||
#define CRYPTOPP_MALLOC_ALIGNMENT_IS_16
|
#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
|
||||||
|
|
@ -649,7 +649,10 @@ NAMESPACE_END
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
# define CRYPTOPP_NOINLINE_DOTDOTDOT
|
# define CRYPTOPP_NOINLINE_DOTDOTDOT
|
||||||
# define CRYPTOPP_NOINLINE __declspec(noinline)
|
# define CRYPTOPP_NOINLINE __declspec(noinline)
|
||||||
#elif defined(__GNUC__) || defined(__xlC__)
|
#elif defined(__xlc__) || defined(__xlC__)
|
||||||
|
# define CRYPTOPP_NOINLINE_DOTDOTDOT ...
|
||||||
|
# define CRYPTOPP_NOINLINE __attribute__((noinline))
|
||||||
|
#elif defined(__GNUC__)
|
||||||
# define CRYPTOPP_NOINLINE_DOTDOTDOT
|
# define CRYPTOPP_NOINLINE_DOTDOTDOT
|
||||||
# define CRYPTOPP_NOINLINE __attribute__((noinline))
|
# define CRYPTOPP_NOINLINE __attribute__((noinline))
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
2
misc.cpp
2
misc.cpp
|
|
@ -282,7 +282,7 @@ void * AlignedAllocate(size_t size)
|
||||||
{
|
{
|
||||||
byte *p;
|
byte *p;
|
||||||
#if defined(CRYPTOPP_APPLE_ALLOC_AVAILABLE)
|
#if defined(CRYPTOPP_APPLE_ALLOC_AVAILABLE)
|
||||||
while ((p = (byte *)calloc(1, size)) == NULLPTR)
|
while ((p = (byte *)malloc(size)) == NULLPTR)
|
||||||
#elif defined(CRYPTOPP_MM_MALLOC_AVAILABLE)
|
#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_MEMALIGN_AVAILABLE)
|
#elif defined(CRYPTOPP_MEMALIGN_AVAILABLE)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue