Skip to content

Commit c71107b

Browse files
committed
[SYCL][NFC] Refactor else-after-return statement
Signed-off-by: Alexey Bader <[email protected]>
1 parent e5249cd commit c71107b

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

sycl/include/CL/sycl/types.hpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -872,19 +872,14 @@ template <typename Type, int NumElements> class vec {
872872

873873
// Special proxies as specialization is not allowed in class scope.
874874
void setValue(int Index, const DataT &Value) {
875-
if (NumElements == 1) {
876-
setValue(Index, Value, (int)0);
877-
} else {
878-
setValue(Index, Value, (float)0);
879-
}
875+
if (NumElements == 1)
876+
setValue(Index, Value, 0);
877+
else
878+
setValue(Index, Value, 0.f);
880879
}
881880

882881
DataT getValue(int Index) const {
883-
if (NumElements == 1) {
884-
return getValue(Index, (int)0);
885-
} else {
886-
return getValue(Index, (float)0);
887-
}
882+
return (NumElements == 1) ? getValue(Index, 0) : getValue(Index, 0.f);
888883
}
889884

890885
// Helpers for variadic template constructor of vec.

0 commit comments

Comments
 (0)