Fix the boolean version of normalizeInput

This commit is contained in:
Jean Pierre Cimalando 2021-03-30 22:38:22 +02:00
parent a4dbf89766
commit 2db25f5468

View file

@ -68,6 +68,10 @@ struct OpcodeSpec
Range<T> bounds;
int flags;
template <class U>
using IsNormalizable = std::integral_constant<
bool, std::is_arithmetic<U>::value && !std::is_same<U, bool>::value>;
/**
* @brief Normalizes an input as needed for the spec
*
@ -76,7 +80,7 @@ struct OpcodeSpec
* @return U
*/
template<class U=T>
typename std::enable_if<std::is_arithmetic<U>::value, U>::type normalizeInput(U input) const
typename std::enable_if<IsNormalizable<U>::value, U>::type normalizeInput(U input) const
{
constexpr int needsOperation {
kNormalizePercent |
@ -107,13 +111,7 @@ struct OpcodeSpec
* @return U
*/
template<class U=T>
typename std::enable_if<!std::is_arithmetic<U>::value, U>::type normalizeInput(U input) const
{
return input;
}
template<>
typename bool normalizeInput(bool input) const
typename std::enable_if<!IsNormalizable<U>::value, U>::type normalizeInput(U input) const
{
return input;
}