mirror of
https://github.com/aicodix/dsp.git
synced 2026-04-27 14:30:36 +00:00
added signum()
This commit is contained in:
parent
f7868833e7
commit
7c19098c87
2 changed files with 25 additions and 0 deletions
|
|
@ -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).
|
||||
|
||||
|
|
|
|||
21
utils.hh
Normal file
21
utils.hh
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue