Skip to content

Commit 0ef1aad

Browse files
Some fixes after the previous change
1 parent 92076d8 commit 0ef1aad

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

sycl/include/sycl/accessor_image.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ class image_accessor
418418

419419
template <int Dims = Dimensions, typename = std::enable_if_t<Dims == 1>>
420420
range<1> get_range() const {
421-
int Range = getRangeInternal();
421+
int Range = static_cast<int>(getRangeInternal());
422422
return range<1>(Range);
423423
}
424424
template <int Dims = Dimensions, typename = std::enable_if_t<Dims == 2>>

sycl/include/syclcompat/math.hpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ inline constexpr RetT extend_vbinary2(AT a, BT b, RetT c,
187187
if constexpr (NeedAdd) {
188188
return temp[0] + temp[1] + c;
189189
}
190-
return sycl::vec<IntT, 2>{temp[0], temp[1]}.template as<sycl::vec<RetT, 1>>();
190+
return static_cast<RetT>(sycl::vec<IntT, 2>{temp[0], temp[1]}.template as<sycl::vec<RetT, 1>>());
191191
}
192192

193193
template <typename RetT, bool NeedSat, bool NeedAdd, typename AT, typename BT,
@@ -213,8 +213,9 @@ inline constexpr RetT extend_vbinary4(AT a, BT b, RetT c,
213213
return temp[0] + temp[1] + temp[2] + temp[3] + c;
214214
}
215215

216-
return sycl::vec<IntT, 4>{temp[0], temp[1], temp[2], temp[3]}
217-
.template as<sycl::vec<RetT, 1>>();
216+
return static_cast<RetT>(
217+
sycl::vec<IntT, 4>{temp[0], temp[1], temp[2], temp[3]}
218+
.template as<sycl::vec<RetT, 1>>());
218219
}
219220

220221
template <typename ValueT> inline bool isnan(const ValueT a) {
@@ -610,7 +611,7 @@ inline unsigned vectorized_unary(unsigned a, const UnaryOperation unary_op) {
610611
auto v1 = v0.as<VecT>();
611612
auto v2 = unary_op(v1);
612613
v0 = v2.template as<sycl::vec<unsigned, 1>>();
613-
return v0;
614+
return unsigned{v0};
614615
}
615616

616617
/// Compute vectorized absolute difference for two values without modulo
@@ -663,7 +664,7 @@ inline unsigned vectorized_isgreater<sycl::ushort2, unsigned>(unsigned a,
663664
v4[0] = v2[0] > v3[0];
664665
v4[1] = v2[1] > v3[1];
665666
v0 = v4.template as<sycl::vec<unsigned, 1>>();
666-
return v0;
667+
return unsigned{v0};
667668
}
668669

669670
/// Returns min(max(val, min_val), max_val)
@@ -989,7 +990,7 @@ inline unsigned vectorized_binary(unsigned a, unsigned b,
989990
auto v4 =
990991
detail::vectorized_binary<VecT, BinaryOperation>()(v2, v3, binary_op);
991992
v0 = v4.template as<sycl::vec<unsigned, 1>>();
992-
return v0;
993+
return unsigned{v0};
993994
}
994995

995996
template <typename T1, typename T2>

sycl/include/syclcompat/util.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ inline int cast_double_to_int(double d, bool use_high32 = true) {
152152
inline double cast_ints_to_double(int high32, int low32) {
153153
sycl::int2 v0{high32, low32};
154154
auto v1 = v0.as<sycl::vec<double, 1>>();
155-
return v1;
155+
return static_cast<double>(v1);
156156
}
157157

158158
/// Reverse the bit order of an unsigned integer

0 commit comments

Comments
 (0)