Cleanup spacemouse plugin

Sets std:: convention and unifies the defined/non-defined interface
This commit is contained in:
Seth Hillbrand 2022-04-01 15:13:48 -07:00
parent 9402b2aeda
commit 0625e20fc0
2 changed files with 6 additions and 5 deletions

View File

@ -48,7 +48,7 @@ void NL_SCHEMATIC_PLUGIN::SetCanvas( EDA_DRAW_PANEL_GAL* aViewport )
#else
NL_SCHEMATIC_PLUGIN::NL_SCHEMATIC_PLUGIN( EDA_DRAW_PANEL_GAL* aViewport )
NL_SCHEMATIC_PLUGIN::NL_SCHEMATIC_PLUGIN()
{
}

View File

@ -34,6 +34,7 @@
#define UTIL_H
#include <config.h>
#include <cmath>
#include <cstdint>
#include <limits>
#include <typeinfo>
@ -129,18 +130,18 @@ int64_t rescale( int64_t aNumerator, int64_t aValue, int64_t aDenominator );
* @return true if the values considered equal within the specified epsilon, otherwise false.
*/
template <class T>
typename std::enable_if<!std::numeric_limits<T>::is_integer, bool>::type
typename std::enable_if<std::is_floating_point<T>::value, bool>::type
equals( T aFirst, T aSecond, T aEpsilon = std::numeric_limits<T>::epsilon() )
{
T diff = fabs( aFirst - aSecond );
T diff = std::abs( aFirst - aSecond );
if( diff < aEpsilon )
{
return true;
}
aFirst = fabs( aFirst );
aSecond = fabs( aSecond );
aFirst = std::abs( aFirst );
aSecond = std::abs( aSecond );
T largest = aFirst > aSecond ? aFirst : aSecond;
if( diff <= largest * aEpsilon )