Skip to content
Snippets Groups Projects
Commit 0c47d7d3 authored by Olivier BICHLER's avatar Olivier BICHLER Committed by Maxence Naud
Browse files

Changed if/else by switch/case

parent ac345a00
No related branches found
No related tags found
No related merge requests found
...@@ -97,63 +97,65 @@ public: ...@@ -97,63 +97,65 @@ public:
} }
AIDGE_ASSERT(length <= mData.size() || length <= mNbElts, "copy length is above capacity"); AIDGE_ASSERT(length <= mData.size() || length <= mNbElts, "copy length is above capacity");
if (srcDt == DataType::Float64) { switch (srcDt) {
case DataType::Float64:
thrust_copy(static_cast<const double*>(src), thrust_copy(static_cast<const double*>(src),
static_cast<T*>(rawPtr(offset)), static_cast<T*>(rawPtr(offset)),
length); length);
} break;
else if (srcDt == DataType::Float32) { case DataType::Float32:
thrust_copy(static_cast<const float*>(src), thrust_copy(static_cast<const float*>(src),
static_cast<T*>(rawPtr(offset)), static_cast<T*>(rawPtr(offset)),
length); length);
} break;
else if (srcDt == DataType::Float16) { case DataType::Float16:
thrust_copy(static_cast<const half_float::half*>(src), thrust_copy(static_cast<const half_float::half*>(src),
static_cast<T*>(rawPtr(offset)), static_cast<T*>(rawPtr(offset)),
length); length);
} break;
else if (srcDt == DataType::Int64) { case DataType::Int64:
thrust_copy(static_cast<const int64_t*>(src), thrust_copy(static_cast<const int64_t*>(src),
static_cast<T*>(rawPtr(offset)), static_cast<T*>(rawPtr(offset)),
length); length);
} break;
else if (srcDt == DataType::UInt64) { case DataType::UInt64:
thrust_copy(static_cast<const uint64_t*>(src), thrust_copy(static_cast<const uint64_t*>(src),
static_cast<T*>(rawPtr(offset)), static_cast<T*>(rawPtr(offset)),
length); length);
} break;
else if (srcDt == DataType::Int32) { case DataType::Int32:
thrust_copy(static_cast<const int32_t*>(src), thrust_copy(static_cast<const int32_t*>(src),
static_cast<T*>(rawPtr(offset)), static_cast<T*>(rawPtr(offset)),
length); length);
} break;
else if (srcDt == DataType::UInt32) { case DataType::UInt32:
thrust_copy(static_cast<const uint32_t*>(src), thrust_copy(static_cast<const uint32_t*>(src),
static_cast<T*>(rawPtr(offset)), static_cast<T*>(rawPtr(offset)),
length); length);
} break;
else if (srcDt == DataType::Int16) { case DataType::Int16:
thrust_copy(static_cast<const int16_t*>(src), thrust_copy(static_cast<const int16_t*>(src),
static_cast<T*>(rawPtr(offset)), static_cast<T*>(rawPtr(offset)),
length); length);
} break;
else if (srcDt == DataType::UInt16) { case DataType::UInt16:
thrust_copy(static_cast<const uint16_t*>(src), thrust_copy(static_cast<const uint16_t*>(src),
static_cast<T*>(rawPtr(offset)), static_cast<T*>(rawPtr(offset)),
length); length);
} break;
else if (srcDt == DataType::Int8) { case DataType::Int8:
thrust_copy(static_cast<const int8_t*>(src), thrust_copy(static_cast<const int8_t*>(src),
static_cast<T*>(rawPtr(offset)), static_cast<T*>(rawPtr(offset)),
length); length);
} break;
else if (srcDt == DataType::UInt8) { case DataType::UInt8:
thrust_copy(static_cast<const uint8_t*>(src), thrust_copy(static_cast<const uint8_t*>(src),
static_cast<T*>(rawPtr(offset)), static_cast<T*>(rawPtr(offset)),
length); length);
} break;
else { default:
AIDGE_THROW_OR_ABORT(std::runtime_error, "Unsupported data type."); AIDGE_THROW_OR_ABORT(std::runtime_error, "Unsupported data type.");
break;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment