tone-generator/util.hpp

18 lines
225 B
C++
Raw Normal View History

2024-08-19 22:43:24 +10:00
#pragma once
template <typename T>
inline T clamp(T v, T a, T b) {
return min(max(v, a), b);
}
2024-08-25 16:53:23 +10:00
template <typename T>
inline void swap(T& a, T& b) {
T t = b;
b = a;
a = t;
}
2024-08-19 22:43:24 +10:00
#define size(V) (sizeof(V) / sizeof(V[0]))