mirror of
https://github.com/jankae/LibreVNA.git
synced 2025-12-06 07:12:10 +01:00
15 lines
216 B
C++
15 lines
216 B
C++
|
|
#include "Util.hpp"
|
||
|
|
|
||
|
|
uint32_t Util::Alias(int64_t f, uint32_t f_s) {
|
||
|
|
// move into f_s range
|
||
|
|
f %= f_s;
|
||
|
|
if (f < 0) {
|
||
|
|
f += f_s;
|
||
|
|
}
|
||
|
|
// fold at half the samplerate
|
||
|
|
if(f >= f_s / 2) {
|
||
|
|
f = f_s - f;
|
||
|
|
}
|
||
|
|
return f;
|
||
|
|
}
|