MCPcopy Create free account
hub / github.com/VcDevel/Vc / randomIndexes

Function randomIndexes

tests/subscript.cpp:71–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71template <typename V, int Modulo> static V randomIndexes()
72{
73 V indexes = positiveRandom<V>() % Modulo;
74 for (std::size_t i = 0; i < V::Size; ++i) {
75 while ((indexes == static_cast<int>(indexes[i])).count() !=
76 1) { // the static_cast prevents an ICE with GCC 4.8.1
77 indexes[i] = (indexes[i] + 1) % Modulo;
78 }
79 }
80 if (V::size() > 1) {
81 VERIFY(none_of(indexes.sorted() == indexes.sorted().rotated(1)))
82 << "\nindexes must not contain duplicate values, otherwise the scatter tests "
83 "will fail without actually doing anything wrong!\nindexes: " << indexes;
84 }
85 return indexes;
86}
87
88TEST_TYPES(V, gathers, AllVectors)
89{

Callers

nothing calls this directly

Calls 3

none_ofFunction · 0.85
sizeFunction · 0.50
countMethod · 0.45

Tested by

no test coverage detected