1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-19 10:05:05 -07:00

Use autoconf to possibly define CPU_ALIGNED_ACCESS_REQUIRED

This commit is contained in:
Frank Denis 2013-09-08 10:39:27 -07:00
parent 2181c087e3
commit 493f71a98a
3 changed files with 8 additions and 22 deletions

View File

@ -353,6 +353,14 @@ __asm__("movl %ebx,%esi\n"
AM_CONDITIONAL([HAVE_CPUID], [test $HAVE_CPUID_V = 1])
AC_SUBST(HAVE_CPUID_V)
AS_CASE([$host_cpu],
[i*86 | x86_64 | powerpc* | s390*],
[AC_MSG_NOTICE([data alignment is not required on this target])],
[*],
[AC_MSG_NOTICE([data alignment is required on this target])
AC_DEFINE([CPU_ALIGNED_ACCESS_REQUIRED], [1], [data alignment is required])]
)
dnl Checks for functions and headers
AC_CHECK_FUNC(clock_gettime, , [AC_CHECK_LIB(rt, clock_gettime)])

View File

@ -285,12 +285,6 @@
# define CPU_Z390
#endif
#if defined(CPU_X86) || defined(CPU_X86_64) || defined(CPU_PPC) || defined(CPU_Z390)
# undef CPU_ALIGNED_ACCESS_REQUIRED
#else
# define CPU_ALIGNED_ACCESS_REQUIRED
#endif
/* 0400-endian-100-be.h */
#if defined(CPU_BE) && !defined(CPU_ALIGNED_ACCESS_REQUIRED)

View File

@ -117,22 +117,6 @@ partial_precompute_tworounds(ECRYPT_ctx* ctx)
/* ------------------------------------------------------------------------- */
#if defined(__amd64__) || defined(__amd64) || defined(__x86_64__ ) || defined(_M_X64)
# define CPU_X86_64
#elif defined(__i386__) || defined(_M_IX86) || defined(__X86__) || defined(_X86_) || defined(__I86__)
# define CPU_X86
#elif defined(powerpc) || defined(__PPC__) || defined(__ppc__) || defined(_ARCH_PPC) || defined(__powerpc__) || defined(__powerpc) || defined(POWERPC) || defined(_M_PPC)
# define CPU_PPC
#elif defined(__s390__) || defined(__zarch__) || defined(__SYSC_ZARCH__)
# define CPU_Z390
#endif
#if defined(CPU_X86) || defined(CPU_X86_64) || defined(CPU_PPC) || defined(CPU_Z390)
# undef CPU_ALIGNED_ACCESS_REQUIRED
#else
# define CPU_ALIGNED_ACCESS_REQUIRED
#endif
#ifndef CPU_ALIGNED_ACCESS_REQUIRED
# define UNALIGNED_U32_READ(P, I) (((const u32 *)(const void *) (P))[(I)])
#else