Fix the boolean version of normalizeInput
This commit is contained in:
parent
a4dbf89766
commit
2db25f5468
1 changed files with 6 additions and 8 deletions
|
|
@ -68,6 +68,10 @@ struct OpcodeSpec
|
||||||
Range<T> bounds;
|
Range<T> bounds;
|
||||||
int flags;
|
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
|
* @brief Normalizes an input as needed for the spec
|
||||||
*
|
*
|
||||||
|
|
@ -76,7 +80,7 @@ struct OpcodeSpec
|
||||||
* @return U
|
* @return U
|
||||||
*/
|
*/
|
||||||
template<class U=T>
|
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 {
|
constexpr int needsOperation {
|
||||||
kNormalizePercent |
|
kNormalizePercent |
|
||||||
|
|
@ -107,13 +111,7 @@ struct OpcodeSpec
|
||||||
* @return U
|
* @return U
|
||||||
*/
|
*/
|
||||||
template<class U=T>
|
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
|
||||||
{
|
|
||||||
return input;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<>
|
|
||||||
typename bool normalizeInput(bool input) const
|
|
||||||
{
|
{
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue