add fft plugin
This commit is contained in:
23
src/utils/math.hpp
Normal file
23
src/utils/math.hpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include <type_traits>
|
||||
#include <cmath>
|
||||
|
||||
namespace hr
|
||||
{
|
||||
template<typename T>
|
||||
T log10(T value)
|
||||
{
|
||||
if constexpr (std::is_same_v<T, float>)
|
||||
return std::log10f(value);
|
||||
else if constexpr (std::is_same_v<T, double>)
|
||||
return std::log10(value);
|
||||
else if constexpr (std::is_same_v<T, long double>)
|
||||
return std::log10l(value);
|
||||
else
|
||||
{
|
||||
static_assert(std::is_same_v<T, float> || std::is_same_v<T, double> || std::is_same_v<T, long double>, "Unsupported type for log10");
|
||||
return std::log10(value); // fallback
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user