Crypto++
8.3
Free C++ class library of cryptographic schemes
config_align.h
Go to the documentation of this file.
1
// config_align.h - written and placed in public domain by Jeffrey Walton
2
// the bits that make up this source file are from the
3
// library's monolithic config.h.
4
5
/// \file config_align.h
6
/// \brief Library configuration file
7
/// \details <tt>config.h</tt> was split into components in May 2019 to better
8
/// integrate with Autoconf and its feature tests. The splitting occurred so
9
/// users could continue to include <tt>config.h</tt> while allowing Autoconf
10
/// to write new <tt>config_asm.h</tt> and new <tt>config_cxx.h</tt> using
11
/// its feature tests.
12
/// \sa <A HREF="https://github.com/weidai11/cryptopp/issues/835">Issue 835</A>
13
/// \since Crypto++ 8.3
14
15
#ifndef CRYPTOPP_CONFIG_ALIGN_H
16
#define CRYPTOPP_CONFIG_ALIGN_H
17
18
#include "
config_asm.h
"
// CRYPTOPP_DISABLE_ASM
19
#include "
config_cpu.h
"
// X86, X32, X64, ARM32, ARM64, etc
20
#include "
config_cxx.h
"
// CRYPTOPP_CXX11_ALIGNAS
21
#include "
config_ver.h
"
// Compiler versions
22
23
// Nearly all Intel's and AMD's have SSE. Enable it independent of SSE ASM and intrinsics.
24
// ARM NEON and ARMv8 ASIMD only need natural alignment of an element in the vector.
25
// Altivec through POWER7 need vector alignment. POWER8 and POWER9 relax the requirement.
26
#if defined(CRYPTOPP_DISABLE_ASM)
27
#define CRYPTOPP_BOOL_ALIGN16 0
28
#elif (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64 || \
29
CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64)
30
#define CRYPTOPP_BOOL_ALIGN16 1
31
#else
32
#define CRYPTOPP_BOOL_ALIGN16 0
33
#endif
34
35
// How to allocate 16-byte aligned memory (for SSE2)
36
// posix_memalign see https://forum.kde.org/viewtopic.php?p=66274
37
#if defined(_MSC_VER)
38
#define CRYPTOPP_MM_MALLOC_AVAILABLE
39
#elif defined(__linux__) || defined(__sun__) || defined(__CYGWIN__)
40
#define CRYPTOPP_MEMALIGN_AVAILABLE
41
#elif defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
42
#define CRYPTOPP_MALLOC_ALIGNMENT_IS_16
43
#elif (defined(_GNU_SOURCE) || ((_XOPEN_SOURCE + 0) >= 600)) && (_POSIX_ADVISORY_INFO > 0)
44
#define CRYPTOPP_POSIX_MEMALIGN_AVAILABLE
45
#else
46
#define CRYPTOPP_NO_ALIGNED_ALLOC
47
#endif
48
49
// Sun Studio Express 3 (December 2006) provides GCC-style attributes.
50
// IBM XL C/C++ alignment modifier per Optimization Guide, pp. 19-20.
51
// __IBM_ATTRIBUTES per XLC 12.1 AIX Compiler Manual, p. 473.
52
// CRYPTOPP_ALIGN_DATA may not be reliable on AIX.
53
#if defined(CRYPTOPP_CXX11_ALIGNAS)
54
#define CRYPTOPP_ALIGN_DATA(x) alignas(x)
55
#elif defined(_MSC_VER)
56
#define CRYPTOPP_ALIGN_DATA(x) __declspec(align(x))
57
#elif defined(__GNUC__) || defined(__clang__) || (__SUNPRO_CC >= 0x5100)
58
#define CRYPTOPP_ALIGN_DATA(x) __attribute__((aligned(x)))
59
#elif defined(__xlc__) || defined(__xlC__)
60
#define CRYPTOPP_ALIGN_DATA(x) __attribute__((aligned(x)))
61
#else
62
#define CRYPTOPP_ALIGN_DATA(x)
63
#endif
64
65
#endif // CRYPTOPP_CONFIG_ALIGN_H
config_asm.h
Library configuration file.
config_cpu.h
Library configuration file.
config_cxx.h
Library configuration file.
config_ver.h
Library configuration file.
Generated on Fri Dec 25 2020 17:16:54 for Crypto++ by
1.8.20