Lines Matching full:alignment
1 //===--- AlignOf.h - Portable calculation of type alignment -----*- C++ -*-===//
26 // For everything other than an abstract class we can calulate alignment by
33 // generated by any class using AlignOf<T> with a manually specified alignment.
44 // Abstract base class helper, this will have the minimal alignment and size
51 // When we have an abstract class type, specialize the alignment computation
64 /// the alignment of the template argument. For example,
65 /// AlignOf<int>::Alignment represents the alignment of type "int". The
66 /// alignment calculated is the minimum alignment, and not necessarily
67 /// the "desired" alignment returned by GCC's __alignof__ (for example). Note
68 /// that because the alignment is an enum value, it can be used as a
78 static constexpr unsigned Alignment = static_cast<unsigned int>(
82 Alignment = static_cast<unsigned int>(
86 enum { Alignment_GreaterEqual_2Bytes = Alignment >= 2 ? 1 : 0 };
87 enum { Alignment_GreaterEqual_4Bytes = Alignment >= 4 ? 1 : 0 };
88 enum { Alignment_GreaterEqual_8Bytes = Alignment >= 8 ? 1 : 0 };
89 enum { Alignment_GreaterEqual_16Bytes = Alignment >= 16 ? 1 : 0 };
91 enum { Alignment_LessEqual_2Bytes = Alignment <= 2 ? 1 : 0 };
92 enum { Alignment_LessEqual_4Bytes = Alignment <= 4 ? 1 : 0 };
93 enum { Alignment_LessEqual_8Bytes = Alignment <= 8 ? 1 : 0 };
94 enum { Alignment_LessEqual_16Bytes = Alignment <= 16 ? 1 : 0 };
98 template <typename T> constexpr unsigned AlignOf<T>::Alignment;
101 /// alignOf - A templated function that returns the minimum alignment of
104 /// alignOf<int>() returns the alignment of an int.
106 inline unsigned alignOf() { return AlignOf<T>::Alignment; }
114 /// integer literal can be used to specify an alignment constraint. Once built
122 template<std::size_t Alignment, std::size_t Size>
124 alignas(Alignment) char buffer[Size];
129 template<std::size_t Alignment, std::size_t Size>
156 template<std::size_t Alignment, std::size_t Size>
161 // a member of a by-value function argument in MSVC, even if the alignment
163 // even include the declspec with the union that forces the alignment because
165 // proper alignment.
253 T6, T7, T8, T9, T10> >::Alignment,