Re-introduce build-in type code for core types

This commit is contained in:
Bastiaan Olij
2021-09-01 13:11:10 +10:00
parent 3a5bd21092
commit 46c63af715
34 changed files with 7409 additions and 14 deletions

View File

@@ -92,6 +92,23 @@
#define unlikely(x) x
#endif
#ifdef REAL_T_IS_DOUBLE
typedef double real_t;
#else
typedef float real_t;
#endif
// Generic swap template.
#ifndef SWAP
#define SWAP(m_x, m_y) __swap_tmpl((m_x), (m_y))
template <class T>
inline void __swap_tmpl(T &x, T &y) {
T aux = x;
x = y;
y = aux;
}
#endif // SWAP
// Home-made index sequence trick, so it can be used everywhere without the costly include of std::tuple.
// https://stackoverflow.com/questions/15014096/c-index-of-type-during-variadic-template-expansion
template <size_t... Is>