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 const &v1, T const &v2)
 Returns the sign bit of the given value.
 
template<typename T >
Min (T const &v1, T const &v2)
 Returns the sign bit of the given value.
 
template<typename T , typename... R>
Max (T const &v, R... rest)
 Returns the sign bit of the given value.
 
template<typename T , typename... R>
Min (T const &v, R... rest)
 Returns the sign bit of the given value.
 
template<typename T >
Clamp (T const &v, T const &minVal, T const &maxVal)
 Returns the sign bit of the given value.
 
template<typename T >
Clamp (T const &v)
 Returns the sign bit of the given value.
 
template<int N, typename T >
Pow (T const &v)
 Returns the sign bit of the given value.
 
template<typename T >
ACosSafe (T v)
 Returns the sign bit of the given value.
 
template<typename T >
ASinSafe (T v)
 Returns the sign bit of the given value.
 
float ACosSafe (float v)
 Returns the sign bit of the given value.
 
float ASinSafe (float v)
 Returns the sign bit of the given value.
 
double ACosSafe (double v)
 Returns the sign bit of the given value.
 
double ASinSafe (double v)
 Returns the sign bit of the given value.
 
template<typename T >
Sqrt (T v)
 Returns the sign bit of the given value.
 
template<typename T >
SqrtSafe (T v)
 Returns the sign bit of the given value.
 
float Sqrt (float v)
 Returns the sign bit of the given value.
 
float SqrtSafe (float v)
 Returns the sign bit of the given value.
 
double Sqrt (double v)
 Returns the sign bit of the given value.
 
double SqrtSafe (double v)
 Returns the sign bit of the given value.
 
template<typename T >
Pi ()
 Returns the sign bit of the given value.
 
float Deg2Rad (int degrees)
 Returns the sign bit of the given value.
 
float Deg2Rad (float degrees)
 Returns the sign bit of the given value.
 
double Deg2Rad (double degrees)
 Returns the sign bit of the given value.
 
float Rad2Deg (float radians)
 Returns the sign bit of the given value.
 
double Rad2Deg (double radians)
 Returns the sign bit of the given value.
 
template<typename T >
bool IsFinite (T v)
 Returns the sign bit of the given value.
 
template<typename T >
bool SignBit (T v)
 Returns the sign bit of the given value.
 
template<typename T , typename S >
CopySign (T magn, S sign)
 Copies the sign bit to magn.
 
template<typename T , typename S >
MultSign (T v, S sign)
 Multiplies the given value with the given sign.
 
template<typename T , typename S >
bool IsDifferentSign (T a, S b)
 Returns true if the sign bits are different.
 
template<typename T >
void MemCopy (T *dest, T const *src, size_t count)
 Returns the sign bit of the given value.
 
template<typename T , typename S >
void MemConvert (T *dest, S const *src, size_t count)
 Returns the sign bit of the given value.
 
template<typename T >
void MemClear (T *dest, size_t count)
 Returns the sign bit of the given value.
 
template<typename T >
void SwapBytes (T &v1, T &v2)
 Returns the sign bit of the given value.
 
template<typename T >
void Swap (T &v1, T &v2)
 Returns the sign bit of the given value.
 
template<bool ascending, typename T >
void Sort2 (T &r0, T &r1, T const &v0, T const &v1)
 Returns the sign bit of the given value.
 
template<bool ascending, typename T >
void Sort2 (T r[2], T const v[2])
 Returns the sign bit of the given value.
 
template<bool ascending, typename T >
void Sort3 (T &r0, T &r1, T &r2, T const &v0, T const &v1, T const &v2)
 Returns the sign bit of the given value.
 
template<bool ascending, typename T >
void Sort3 (T r[3], T const v[3])
 Returns the sign bit of the given value.
 
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)
 Returns the sign bit of the given value.
 
template<bool ascending, typename T >
void Sort4 (T r[4], T const v[4])
 Returns the sign bit of the given value.