aboutsummaryrefslogtreecommitdiff
path: root/tests/Utils.h
diff options
context:
space:
mode:
authorJohn Richardson <john.richardson@arm.com>2017-10-04 15:27:37 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:35:24 +0000
commit3c5f949ad73fff961a7d193c9275b73df13b8096 (patch)
treef7285b4223d2f40907ac5edb4d32bfe3c2883830 /tests/Utils.h
parent0063380ca6e43d04722707c707e610b59e1f8dde (diff)
downloadComputeLibrary-3c5f949ad73fff961a7d193c9275b73df13b8096.tar.gz
COMPMID-575: Port Magnitude to new validation
Change-Id: I2600947bef30853d00adfa4b919dbcb860de9bfd Reviewed-on: http://mpd-gerrit.cambridge.arm.com/91717 Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com> Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'tests/Utils.h')
-rw-r--r--tests/Utils.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/Utils.h b/tests/Utils.h
index 4745b8bbd7..465cba88ab 100644
--- a/tests/Utils.h
+++ b/tests/Utils.h
@@ -106,6 +106,10 @@ using promote_t = typename promote<T>::type;
template <typename T>
using make_signed_conditional_t = typename std::conditional<std::is_integral<T>::value, std::make_signed<T>, std::common_type<T>>::type;
+
+template <typename T>
+using make_unsigned_conditional_t = typename std::conditional<std::is_integral<T>::value, std::make_unsigned<T>, std::common_type<T>>::type;
+
// clang-format on
// *INDENT-ON*
}
@@ -298,6 +302,16 @@ struct common_promoted_signed_type
using intermediate_type = typename traits::make_signed_conditional_t<promoted_type>::type;
};
+/** Find the unsigned promoted common type.
+ */
+template <typename... T>
+struct common_promoted_unsigned_type
+{
+ using common_type = typename std::common_type<T...>::type;
+ using promoted_type = traits::promote_t<common_type>;
+ using intermediate_type = typename traits::make_unsigned_conditional_t<promoted_type>::type;
+};
+
/** Convert a linear index into n-dimensional coordinates.
*
* @param[in] shape Shape of the n-dimensional tensor.