tone-generator/util.hpp

19 lines
264 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 bm(V) (((uint64_t)1 << V) - 1)
#define size(V) (sizeof(V) / sizeof(V[0]))