include/common.h
branchpyrit
changeset 104 2274a07510c1
parent 100 c005054bf4c1
equal deleted inserted replaced
103:3b3257a410fe 104:2274a07510c1
    32 
    32 
    33 #include <stdio.h>
    33 #include <stdio.h>
    34 #include <math.h>
    34 #include <math.h>
    35 #include <float.h>
    35 #include <float.h>
    36 #include <pthread.h>
    36 #include <pthread.h>
       
    37 #include <stdint.h>
    37 #include <string>
    38 #include <string>
    38 
    39 
    39 using namespace std;
    40 using namespace std;
    40 
       
    41 #ifndef MSVC
       
    42 # include <stdint.h>
       
    43 #else
       
    44 #ifndef _SDL_config_win32_h
       
    45 /* these stdint.h typedefs are not available in MSVC
       
    46  * but are defined in SDL_config_win32.h */
       
    47 typedef __int8				int8_t;
       
    48 typedef __int16				int16_t;
       
    49 typedef __int32				int32_t;
       
    50 typedef __int64				int64_t;
       
    51 typedef unsigned __int8		uint8_t;
       
    52 typedef unsigned __int16	uint16_t;
       
    53 typedef unsigned __int32	uint32_t;
       
    54 typedef unsigned __int64	uint64_t;
       
    55 #endif
       
    56 #endif
       
    57 
    41 
    58 
    42 
    59 #ifdef PYRIT_DOUBLE
    43 #ifdef PYRIT_DOUBLE
    60 # define Float double
    44 # define Float double
    61 # define Eps DBL_EPSILON
    45 # define Eps DBL_EPSILON
    66 # define Eps 2e-6f
    50 # define Eps 2e-6f
    67 # define Inf FLT_MAX
    51 # define Inf FLT_MAX
    68 # define PI (float)M_PI
    52 # define PI (float)M_PI
    69 #endif
    53 #endif
    70 
    54 
    71 // enable M_* constants in MSVC
       
    72 #define _USE_MATH_DEFINES
       
    73 
       
    74 #ifdef MSVC
       
    75 #define NORETURN __declspec(noreturn)
       
    76 #else
       
    77 #define NORETURN __attribute__((noreturn))
    55 #define NORETURN __attribute__((noreturn))
    78 #endif
       
    79 
    56 
    80 /**
    57 /**
    81  * verbosity level
    58  * verbosity level
    82  *
    59  *
    83  * - 0: only errors and warnings (E, W)
    60  * - 0: only errors and warnings (E, W)