From 11e2571aedb28e66100c0528c4d86503f057f4f4 Mon Sep 17 00:00:00 2001 From: Antonio Maiorano Date: Tue, 6 Sep 2022 18:40:33 +0000 Subject: [PATCH] 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 Reviewed-by: Ben Clayton Commit-Queue: Antonio Maiorano --- src/tint/number.h | 14 ++++++++------ src/tint/resolver/const_eval_test.cc | 2 ++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/tint/number.h b/src/tint/number.h index 5321158fdc..29ae227039 100644 --- a/src/tint/number.h +++ b/src/tint/number.h @@ -78,16 +78,18 @@ constexpr bool IsFloatingPoint = std::is_floating_point_v || std::is_same_v; /// Evaluates to true iff T or Number is an integral type. -template , UnwrapNumber, T>> -constexpr bool IsIntegral = std::is_integral_v; +template +constexpr bool IsIntegral = std::is_integral_v>; /// Evaluates to true iff T or Number is a signed integer type. -template , UnwrapNumber, T>> -constexpr bool IsSignedIntegral = std::is_integral_v && std::is_signed_v; +template +constexpr bool IsSignedIntegral = + std::is_integral_v> && std::is_signed_v>; /// Evaluates to true iff T or Number is an unsigned integer type. -template , UnwrapNumber, T>> -constexpr bool IsUnsignedIntegral = std::is_integral_v && std::is_unsigned_v; +template +constexpr bool IsUnsignedIntegral = + std::is_integral_v> && std::is_unsigned_v>; /// Evaluates to true iff T is an integer type, floating-point type or is NumberKindF16. template diff --git a/src/tint/resolver/const_eval_test.cc b/src/tint/resolver/const_eval_test.cc index d21d60aab1..1f745a3b33 100644 --- a/src/tint/resolver/const_eval_test.cc +++ b/src/tint/resolver/const_eval_test.cc @@ -99,6 +99,7 @@ template return std::move(v1); } +// Concats vectors `vs` into `v1` template 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 void ConcatIntoIf([[maybe_unused]] Vec& v1, [[maybe_unused]] Vecs&&... vs) { if constexpr (condition) {