diff --git a/README.md b/README.md index df177db..0499d2a 100644 --- a/README.md +++ b/README.md @@ -66,3 +66,7 @@ Faster alternative (no Inf/NaN handling) to the std::complex implementation. Mixed-radix [decimation-in-time](https://en.wikipedia.org/wiki/Cooley%E2%80%93Tukey_FFT_algorithm) [fast Fourier transform](https://en.wikipedia.org/wiki/Fast_Fourier_transform) +### [utils.hh](utils.hh) + +Some everyday helpers, like the [signum function](https://en.wikipedia.org/wiki/Sign_function). + diff --git a/utils.hh b/utils.hh new file mode 100644 index 0000000..a0549ec --- /dev/null +++ b/utils.hh @@ -0,0 +1,21 @@ +/* +Some little helpers + +Copyright 2018 Ahmet Inan +*/ + +#ifndef UTILS_HH +#define UTILS_HH + +namespace DSP { + +template +int signum(TYPE v) +{ + return (v > TYPE(0)) - (v < TYPE(0)); +} + +} + +#endif +