tone-generator/util.hpp

18 lines
225 B
C++

#pragma once
template <typename T>
inline T clamp(T v, T a, T b) {
return min(max(v, a), b);
}
template <typename T>
inline void swap(T& a, T& b) {
T t = b;
b = a;
a = t;
}
#define size(V) (sizeof(V) / sizeof(V[0]))