@@ -1202,7 +1202,8 @@ template <typename Type, int NumElements> class vec {
1202
1202
#ifdef __SYCL_USE_EXT_VECTOR_TYPE__
1203
1203
template <int Num = NumElements, typename Ty = int ,
1204
1204
typename = typename detail::enable_if_t <1 != Num>>
1205
- void setValue (EnableIfNotHostHalf<Ty> Index, const DataT &Value, int ) {
1205
+ constexpr void setValue (EnableIfNotHostHalf<Ty> Index, const DataT &Value,
1206
+ int ) {
1206
1207
m_Data[Index] = Value;
1207
1208
}
1208
1209
@@ -1214,7 +1215,7 @@ template <typename Type, int NumElements> class vec {
1214
1215
1215
1216
template <int Num = NumElements, typename Ty = int ,
1216
1217
typename = typename detail::enable_if_t <1 != Num>>
1217
- void setValue (EnableIfHostHalf<Ty> Index, const DataT &Value, int ) {
1218
+ constexpr void setValue (EnableIfHostHalf<Ty> Index, const DataT &Value, int ) {
1218
1219
m_Data.s [Index] = Value;
1219
1220
}
1220
1221
@@ -1226,7 +1227,7 @@ template <typename Type, int NumElements> class vec {
1226
1227
#else // __SYCL_USE_EXT_VECTOR_TYPE__
1227
1228
template <int Num = NumElements,
1228
1229
typename = typename detail::enable_if_t <1 != Num>>
1229
- void setValue (int Index, const DataT &Value, int ) {
1230
+ constexpr void setValue (int Index, const DataT &Value, int ) {
1230
1231
m_Data.s [Index] = Value;
1231
1232
}
1232
1233
@@ -1239,7 +1240,7 @@ template <typename Type, int NumElements> class vec {
1239
1240
1240
1241
template <int Num = NumElements,
1241
1242
typename = typename detail::enable_if_t <1 == Num>>
1242
- void setValue (int , const DataT &Value, float ) {
1243
+ constexpr void setValue (int , const DataT &Value, float ) {
1243
1244
m_Data = Value;
1244
1245
}
1245
1246
@@ -1250,7 +1251,7 @@ template <typename Type, int NumElements> class vec {
1250
1251
}
1251
1252
1252
1253
// Special proxies as specialization is not allowed in class scope.
1253
- void setValue (int Index, const DataT &Value) {
1254
+ constexpr void setValue (int Index, const DataT &Value) {
1254
1255
if (NumElements == 1 )
1255
1256
setValue (Index, Value, 0 );
1256
1257
else
@@ -1263,13 +1264,13 @@ template <typename Type, int NumElements> class vec {
1263
1264
1264
1265
// Helpers for variadic template constructor of vec.
1265
1266
template <typename T, typename ... argTN>
1266
- int vaargCtorHelper (int Idx, const T &arg) {
1267
+ constexpr int vaargCtorHelper (int Idx, const T &arg) {
1267
1268
setValue (Idx, arg);
1268
1269
return Idx + 1 ;
1269
1270
}
1270
1271
1271
1272
template <typename DataT_, int NumElements_>
1272
- int vaargCtorHelper (int Idx, const vec<DataT_, NumElements_> &arg) {
1273
+ constexpr int vaargCtorHelper (int Idx, const vec<DataT_, NumElements_> &arg) {
1273
1274
for (size_t I = 0 ; I < NumElements_; ++I) {
1274
1275
setValue (Idx + I, arg.getValue (I));
1275
1276
}
@@ -1278,9 +1279,9 @@ template <typename Type, int NumElements> class vec {
1278
1279
1279
1280
template <typename DataT_, int NumElements_, typename T2, typename T3,
1280
1281
template <typename > class T4 , int ... T5>
1281
- int vaargCtorHelper ( int Idx,
1282
- const detail::SwizzleOp<vec<DataT_, NumElements_>, T2, T3 ,
1283
- T4, T5...> &arg) {
1282
+ constexpr int
1283
+ vaargCtorHelper ( int Idx, const detail::SwizzleOp<vec<DataT_, NumElements_>,
1284
+ T2, T3, T4, T5...> &arg) {
1284
1285
size_t NumElems = sizeof ...(T5);
1285
1286
for (size_t I = 0 ; I < NumElems; ++I) {
1286
1287
setValue (Idx + I, arg.getValue (I));
@@ -1290,9 +1291,10 @@ template <typename Type, int NumElements> class vec {
1290
1291
1291
1292
template <typename DataT_, int NumElements_, typename T2, typename T3,
1292
1293
template <typename > class T4 , int ... T5>
1293
- int vaargCtorHelper (int Idx,
1294
- const detail::SwizzleOp<const vec<DataT_, NumElements_>,
1295
- T2, T3, T4, T5...> &arg) {
1294
+ constexpr int
1295
+ vaargCtorHelper (int Idx,
1296
+ const detail::SwizzleOp<const vec<DataT_, NumElements_>, T2,
1297
+ T3, T4, T5...> &arg) {
1296
1298
size_t NumElems = sizeof ...(T5);
1297
1299
for (size_t I = 0 ; I < NumElems; ++I) {
1298
1300
setValue (Idx + I, arg.getValue (I));
@@ -1301,14 +1303,15 @@ template <typename Type, int NumElements> class vec {
1301
1303
}
1302
1304
1303
1305
template <typename T1, typename ... argTN>
1304
- void vaargCtorHelper (int Idx, const T1 &arg, const argTN &... args) {
1306
+ constexpr void vaargCtorHelper (int Idx, const T1 &arg,
1307
+ const argTN &... args) {
1305
1308
int NewIdx = vaargCtorHelper (Idx, arg);
1306
1309
vaargCtorHelper (NewIdx, args...);
1307
1310
}
1308
1311
1309
1312
template <typename DataT_, int NumElements_, typename ... argTN>
1310
- void vaargCtorHelper (int Idx, const vec<DataT_, NumElements_> &arg,
1311
- const argTN &... args) {
1313
+ constexpr void vaargCtorHelper (int Idx, const vec<DataT_, NumElements_> &arg,
1314
+ const argTN &... args) {
1312
1315
int NewIdx = vaargCtorHelper (Idx, arg);
1313
1316
vaargCtorHelper (NewIdx, args...);
1314
1317
}
0 commit comments