| 69 | } |
| 70 | |
| 71 | template <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 | |
| 88 | TEST_TYPES(V, gathers, AllVectors) |
| 89 | { |