// types.h // // Author: J.A. de Jong - ASCEE // // Description: // Typedefs and namespace pollution for stuff that is almost always // needed. ////////////////////////////////////////////////////////////////////// #pragma once #include "lasp_config.h" #include // // Branch prediction performance improvement #if !defined(islikely) && defined(__GNUC__) && !defined(LASP_DEBUG) #define islikely(x) __builtin_expect(!!(x), 1) #define isunlikely(x) __builtin_expect(!!(x), 0) #else #define islikely(x) (x) #define isunlikely(x) (x) #endif // !defined(likely) /// We often use boolean values #ifndef __cplusplus #include // true, false #include #endif static_assert(sizeof(size_t) == 8); typedef size_t us; /* Size type I always use */ // To change the whole code to 32-bit floating points, change this to // float. #if LASP_FLOAT_SIZE == 32 typedef float d; /* Shortcut for floating point - single precision */ #elif LASP_FLOAT_SIZE == 64 typedef double d; /* Shortcut for floating point - double precision */ #else #error LASP_FLOAT_SIZE should be either 32 or 64 #endif #ifdef __cplusplus #include typedef std::complex c; #else #include #if LASP_FLOAT_SIZE == 32 typedef float complex c; #else typedef double complex c; #endif #endif