summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Ramacher <sebastian+dev@ramacher.at>2014-02-22 17:08:47 +0100
committerSebastian Ramacher <sebastian+dev@ramacher.at>2014-02-22 17:08:47 +0100
commit6a3bd8bef9522f0df7cb259cccc0fdec917e2da8 (patch)
tree0d3ca9366af1a99dd9e565cf117ad4e57e25d0cd
parent85c2ac670937bbe5c369e6f205213453515e37c1 (diff)
downloadpycrypto-6a3bd8bef9522f0df7cb259cccc0fdec917e2da8.tar.gz
Prefer C11's aligned_alloc if it is available
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
-rw-r--r--src/AESNI.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/AESNI.c b/src/AESNI.c
index b2daa81..cbd1448 100644
--- a/src/AESNI.c
+++ b/src/AESNI.c
@@ -49,16 +49,16 @@ typedef struct {
static void* memalign_wrapper(size_t alignment, size_t size)
{
-#if defined(HAVE_POSIX_MEMALIGN)
+#if defined(HAVE_ALIGNED_ALLOC)
+ /* aligned_alloc is defined by C11 */
+ return aligned_alloc(alignment, size);
+#elif defined(HAVE_POSIX_MEMALIGN)
/* posix_memalign is defined by POSIX */
void* tmp = NULL;
int result = posix_memalign(&tmp, alignment, size);
if (result != 0)
return NULL;
return tmp;
-#elif defined(HAVE_ALIGNED_ALLOC)
- /* aligned_alloc is defined by C11 */
- return aligned_alloc(alignment, size);
#elif defined(HAVE__ALIGNED_MALLOC)
/* _aligned_malloc is available on Windows */
return _aligned_malloc(size, alignment);