refactor ALIGN16 macro to types.h

This commit is contained in:
Jacob Barthelmeh
2016-09-01 21:24:03 +00:00
parent 41912b92c6
commit 8e4ccd355c
3 changed files with 20 additions and 31 deletions

View File

@@ -46,23 +46,8 @@
#include <emmintrin.h>
#include <smmintrin.h>
#if !defined (ALIGN16)
#if defined (__GNUC__)
#define ALIGN16 __attribute__ ( (aligned (16)))
#elif defined(_MSC_VER)
/* disable align warning, we want alignment ! */
#pragma warning(disable: 4324)
#define ALIGN16 __declspec (align (16))
#else
#define ALIGN16
#endif
#endif
#endif /* WOLFSSL_AESNI */
#if !defined (ALIGN16)
#define ALIGN16
#endif
#endif /* HAVE_FIPS */
#ifdef __cplusplus

View File

@@ -54,22 +54,6 @@ enum {
#ifndef WOLFSSL_TI_HASH
#ifdef WOLFSSL_ARMASM /* slight performance increase with aligned memory */
#if !defined (ALIGN16)
#if defined (__GNUC__)
#define ALIGN16 __attribute__ ( (aligned (16)))
#elif defined(_MSC_VER)
/* disable align warning, we want alignment ! */
#pragma warning(disable: 4324)
#define ALIGN16 __declspec (align (16))
#else
#define ALIGN16
#endif
#endif
#else /* not using ARM ASM*/
#define ALIGN16
#endif /* WOLFSSL_ARMASM */
/* Sha256 digest */
typedef struct Sha256 {
word32 buffLen; /* in bytes */

View File

@@ -386,6 +386,26 @@
#define INVALID_DEVID -2
/* AESNI requires alignment and ARMASM gains some performance from it */
#if defined(WOLFSSL_AESNI) || defined(WOLFSSL_ARMASM)
#if !defined (ALIGN16)
#if defined (__GNUC__)
#define ALIGN16 __attribute__ ( (aligned (16)))
#elif defined(_MSC_VER)
/* disable align warning, we want alignment ! */
#pragma warning(disable: 4324)
#define ALIGN16 __declspec (align (16))
#else
#define ALIGN16
#endif
#endif
#else
#ifndef ALIGN16
#define ALIGN16
#endif
#endif /* WOLFSSL_AESNI or WOLFSSL_ARMASM */
#ifdef __cplusplus
} /* extern "C" */
#endif