24 #include <Vc/Allocator>
34 return std::min(
sizeof(
void*),
sizeof(
typename Vec::EntryType)) - 1;
41 template<
typename T>
struct SomeStruct {
char a;
T x; };
45 const size_t mask = alignmentMask<V>();
46 const char *
const null = 0;
49 for (
int i = 0; i < 11; ++i) {
50 COMPARE((reinterpret_cast<char *>(&v[i]) - null) & mask, 0u) <<
"&v[i] = " << &v[i] <<
", mask = " << mask <<
", i = " << i;
53 std::vector<SomeStruct<V>, Vc::Allocator<SomeStruct<V> > > v2(11);
54 for (
int i = 0; i < 11; ++i) {
55 COMPARE((reinterpret_cast<char *>(&v2[i]) - null) & mask, 0u) <<
"&v2[i] = " << &v2[i] <<
", mask = " << mask <<
", i = " << i;
59 std::vector<SomeStruct<V>, Vc::Allocator<SomeStruct<V> > > v4(v2);
61 typedef typename V::EntryType
T;
62 for (
int i = 1; i < 100; ++i) {
63 std::vector<T, Vc::Allocator<T> > v5(i);
64 const size_t expectedAlignment =
Vc_ALIGNOF(V);
65 COMPARE((&v5[0] - static_cast<const T *>(0)) *
sizeof(T) & (expectedAlignment - 1), 0u);
69 int main(
int argc,
char **argv)
static Vc_ALWAYS_INLINE int_v min(const int_v &x, const int_v &y)
void initTest(int argc, char **argv)
int main(int argc, char **argv)
#define testAllTypes(name)
void stdVectorAlignment()
#define Vc_ALIGNOF(_TYPE_)