mirror of
https://github.com/aicodix/dsp.git
synced 2026-04-27 14:30:36 +00:00
27 lines
320 B
C++
27 lines
320 B
C++
/*
|
|
Some little helpers
|
|
|
|
Copyright 2018 Ahmet Inan <inan@aicodix.de>
|
|
*/
|
|
|
|
#ifndef UTILS_HH
|
|
#define UTILS_HH
|
|
|
|
namespace DSP {
|
|
|
|
template <typename TYPE>
|
|
int signum(TYPE v)
|
|
{
|
|
return (v > TYPE(0)) - (v < TYPE(0));
|
|
}
|
|
|
|
template <typename X, typename AB>
|
|
AB lerp(X x, AB a, AB b)
|
|
{
|
|
return (X(1) - x) * a + x * b;
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|