tint: Minor improvements
I forgot to fold this into crbug.com/tint/100861 Bug: tint:1581 Change-Id: I8f8faef7765b525316e2c927504cce88a93d24ee Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101303 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
parent
185fd3deca
commit
11e2571aed
|
@ -78,16 +78,18 @@ constexpr bool IsFloatingPoint =
|
|||
std::is_floating_point_v<U> || std::is_same_v<T, detail::NumberKindF16>;
|
||||
|
||||
/// Evaluates to true iff T or Number<T> is an integral type.
|
||||
template <typename T, typename U = std::conditional_t<IsNumber<T>, UnwrapNumber<T>, T>>
|
||||
constexpr bool IsIntegral = std::is_integral_v<U>;
|
||||
template <typename T>
|
||||
constexpr bool IsIntegral = std::is_integral_v<UnwrapNumber<T>>;
|
||||
|
||||
/// Evaluates to true iff T or Number<T> is a signed integer type.
|
||||
template <typename T, typename U = std::conditional_t<IsNumber<T>, UnwrapNumber<T>, T>>
|
||||
constexpr bool IsSignedIntegral = std::is_integral_v<U> && std::is_signed_v<U>;
|
||||
template <typename T>
|
||||
constexpr bool IsSignedIntegral =
|
||||
std::is_integral_v<UnwrapNumber<T>> && std::is_signed_v<UnwrapNumber<T>>;
|
||||
|
||||
/// Evaluates to true iff T or Number<T> is an unsigned integer type.
|
||||
template <typename T, typename U = std::conditional_t<IsNumber<T>, UnwrapNumber<T>, T>>
|
||||
constexpr bool IsUnsignedIntegral = std::is_integral_v<U> && std::is_unsigned_v<U>;
|
||||
template <typename T>
|
||||
constexpr bool IsUnsignedIntegral =
|
||||
std::is_integral_v<UnwrapNumber<T>> && std::is_unsigned_v<UnwrapNumber<T>>;
|
||||
|
||||
/// Evaluates to true iff T is an integer type, floating-point type or is NumberKindF16.
|
||||
template <typename T>
|
||||
|
|
|
@ -99,6 +99,7 @@ template <typename Vec, typename... Vecs>
|
|||
return std::move(v1);
|
||||
}
|
||||
|
||||
// Concats vectors `vs` into `v1`
|
||||
template <typename Vec, typename... Vecs>
|
||||
void ConcatInto(Vec& v1, Vecs&&... vs) {
|
||||
auto total_size = v1.size() + (vs.size() + ...);
|
||||
|
@ -106,6 +107,7 @@ void ConcatInto(Vec& v1, Vecs&&... vs) {
|
|||
(std::move(vs.begin(), vs.end(), std::back_inserter(v1)), ...);
|
||||
}
|
||||
|
||||
// Concats vectors `vs` into `v1` iff `condition` is true
|
||||
template <bool condition, typename Vec, typename... Vecs>
|
||||
void ConcatIntoIf([[maybe_unused]] Vec& v1, [[maybe_unused]] Vecs&&... vs) {
|
||||
if constexpr (condition) {
|
||||
|
|
Loading…
Reference in New Issue