Skip to content

Commit 1964034

Browse files
hidekisaitovladimirlaz
authored andcommitted
[SYCL] Change Indexer to use C++11 feature, from C++14.
Signed-off-by: Saito, Hideki <[email protected]> Signed-off-by: Vladimir Lazarev <[email protected]>
1 parent 6d1e297 commit 1964034

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

sycl/include/CL/sycl/types.hpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,10 +1242,16 @@ class SwizzleOp {
12421242

12431243
// Begin hi/lo, even/odd, xyzw, and rgba swizzles.
12441244
private:
1245-
// Indexer used in the swizzles.def. C++14
1245+
// Indexer used in the swizzles.def. C++11 way, a bit more verbose
1246+
// than C++14 way.
1247+
struct IndexerHelper {
1248+
static const constexpr int IDXs[] = {Indexes...};
1249+
static constexpr int get(int index) {
1250+
return IDXs[index >= getNumElements() ? 0 : index];
1251+
}
1252+
};
12461253
static constexpr int Indexer(int index) {
1247-
const constexpr int IDXs[] = {Indexes...};
1248-
return IDXs[index >= getNumElements() ? 0 : index];
1254+
return IndexerHelper::get(index);
12491255
}
12501256

12511257
public:

0 commit comments

Comments
 (0)