fix-up LTC_FAST related defines/typedefs

This commit is contained in:
Steffen Jaeckel 2017-10-03 13:32:17 +02:00
parent bb291cbbeb
commit cb34ef8626

View File

@ -219,20 +219,6 @@ LTC_EXPORT int LTC_CALL XSTRCMP(const char *s1, const char *s2);
#endif #endif
#endif #endif
/* No LTC_FAST if: explicitly disabled OR non-gcc/non-clang compiler OR old gcc OR using -ansi -std=c99 */
#if defined(LTC_NO_FAST) || (__GNUC__ < 4) || defined(__STRICT_ANSI__)
#undef LTC_FAST
#endif
#ifdef LTC_FAST
#define LTC_FAST_TYPE_PTR_CAST(x) ((LTC_FAST_TYPE*)(void*)(x))
#ifdef ENDIAN_64BITWORD
typedef ulong64 __attribute__((__may_alias__)) LTC_FAST_TYPE;
#else
typedef ulong32 __attribute__((__may_alias__)) LTC_FAST_TYPE;
#endif
#endif
#ifdef ENDIAN_64BITWORD #ifdef ENDIAN_64BITWORD
typedef ulong64 ltc_mp_digit; typedef ulong64 ltc_mp_digit;
#else #else
@ -245,11 +231,24 @@ typedef ulong32 ltc_mp_digit;
#undef ENDIAN_32BITWORD #undef ENDIAN_32BITWORD
#undef ENDIAN_64BITWORD #undef ENDIAN_64BITWORD
#undef LTC_FAST #undef LTC_FAST
#undef LTC_FAST_TYPE
#define LTC_NO_ROLC #define LTC_NO_ROLC
#define LTC_NO_BSWAP #define LTC_NO_BSWAP
#endif #endif
/* No LTC_FAST if: explicitly disabled OR non-gcc/non-clang compiler OR old gcc OR using -ansi -std=c99 */
#if defined(LTC_NO_FAST) || (__GNUC__ < 4) || defined(__STRICT_ANSI__)
#undef LTC_FAST
#endif
#ifdef LTC_FAST
#define LTC_FAST_TYPE_PTR_CAST(x) ((LTC_FAST_TYPE*)(void*)(x))
#ifdef ENDIAN_64BITWORD
typedef ulong64 __attribute__((__may_alias__)) LTC_FAST_TYPE;
#else
typedef ulong32 __attribute__((__may_alias__)) LTC_FAST_TYPE;
#endif
#endif
#if !defined(ENDIAN_NEUTRAL) && (defined(ENDIAN_BIG) || defined(ENDIAN_LITTLE)) && !(defined(ENDIAN_32BITWORD) || defined(ENDIAN_64BITWORD)) #if !defined(ENDIAN_NEUTRAL) && (defined(ENDIAN_BIG) || defined(ENDIAN_LITTLE)) && !(defined(ENDIAN_32BITWORD) || defined(ENDIAN_64BITWORD))
#error You must specify a word size as well as endianess in tomcrypt_cfg.h #error You must specify a word size as well as endianess in tomcrypt_cfg.h
#endif #endif