Files Class List
cyCore.h File Reference

Detailed Description

Core functions and macros.

Author
Cem Yuksel

Core functions and macros for math and other common operations

#include <cstdlib>
#include <cstring>
#include <cstdint>
#include <cassert>
#include <cmath>
#include <type_traits>
#include <limits>
#include <immintrin.h>

Macros

#define constexpr
 
#define restrict
 
#define CY_NODISCARD
 
#define CY_CLASS_FUNCTION_DEFAULT   {}
 
#define CY_CLASS_FUNCTION_DELETE   { static_assert(false,"Calling deleted method."); }
 
#define nodefault   default:
 

Functions

Common math function templates
template<typename T >
Max (T v1, T v2)
 
template<typename T >
Min (T v1, T v2)
 
template<typename T >
Max (T v1, T v2, T v3)
 
template<typename T >
Min (T v1, T v2, T v3)
 
template<typename T >
Max (T v1, T v2, T v3, T const v4)
 
template<typename T >
Min (T v1, T v2, T v3, T const v4)
 
template<typename T >
Clamp (T v, T minVal=T(0), T maxVal=T(1))
 
template<typename T >
ACosSafe (T v)
 
template<typename T >
ASinSafe (T v)
 
template<typename T >
Sqrt (T v)
 
template<typename T >
SqrtSafe (T v)
 
template<typename T >
Pi ()
 
template<typename T >
bool IsFinite (T v)
 
template<typename T >
void MemCopy (T *dest, T const *src, size_t count)
 
template<typename T , typename S >
void MemConvert (T *dest, S const *src, size_t count)
 
template<typename T >
void MemClear (T *dest, size_t count)
 
template<typename T >
void SwapBytes (T &v1, T &v2)
 
template<typename T >
void Swap (T &v1, T &v2)
 
template<bool ascending, typename T >
void Sort2 (T &r0, T &r1, T const &v0, T const &v1)
 
template<bool ascending, typename T >
void Sort2 (T r[2], T const v[2])
 
template<bool ascending, typename T >
void Sort3 (T &r0, T &r1, T &r2, T const &v0, T const &v1, T const &v2)
 
template<bool ascending, typename T >
void Sort3 (T r[3], T const v[3])
 
template<bool ascending, typename T >
void Sort4 (T &r0, T &r1, T &r2, T &r3, T const &v0, T const &v1, T const &v2, T const &v3)
 
template<bool ascending, typename T >
void Sort4 (T r[4], T const v[4])