// types.h // // Author: J.A. de Jong - ASCEE // // Description: // Typedefs and namespace pollution for stuff that is almost always // needed. ////////////////////////////////////////////////////////////////////// #pragma once #ifndef LASP_TYPES_H #define LASP_TYPES_H #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 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 == 32 typedef float d; /* Shortcut for double */ #elif LASP_FLOAT == 64 typedef double d; /* Shortcut for double */ #else #error LASP_FLOAT should be either 32 or 64 #endif #include #ifdef __cplusplus typedef std::complex c; #else #if LASP_FLOAT == 32 typedef float complex c; #else typedef double complex c; #endif #endif /// I need these numbers so often, that they can be in the global /// namespace. #define LASP_SUCCESS 0 #define LASP_INTERRUPTED (-3) #define LASP_MALLOC_FAILED (-1) #define LASP_FAILURE (-2) #endif // LASP_TYPES_H //////////////////////////////////////////////////////////////////////