31 inline static double sqr (
double x )
35 #define NANCHECK(x) if(x!=x) errmsg("NaN! occured")
36 #define NANBOOL(x) x!=x?true:false
38 #define errmsg(message) {fprintf(stderr,"\033[31mERROR:\033[0m\t%s\n\t\033[90m(from %s, %s(...) , line %d)\033[0m\n", message, __FILE__,__FUNCTION__,__LINE__);}
39 #define infomsg(message) {fprintf(stderr,"\033[32mINFO:\033[0m\t%s\n\t\033[90m(from %s, %s(...) , line %d)\033[0m\n", message, __FILE__,__FUNCTION__,__LINE__);}
40 #define warnmsg(message) {fprintf(stderr,"\033[33mWARN:\033[0m\t%s\n\t\033[90m(from %s, %s(...) , line %d)\033[0m\n", message, __FILE__,__FUNCTION__,__LINE__);}
42 #define errmsgf(format,...) {char tmp[1024];snprintf(tmp,1024,format,__VA_ARGS__);errmsg(tmp);}
43 #define infomsgf(format,...) {char tmp[1024];snprintf(tmp,1024,format,__VA_ARGS__);infomsg(tmp);}
44 #define warnmsgf(format,...) {char tmp[1024];snprintf(tmp,1024,format,__VA_ARGS__);warnmsg(tmp);}
48 #define rambrain_pthread_mutex_lock(x) infomsg("Lock of " #x " ") pthread_mutex_lock(x);
49 #define rambrain_pthread_mutex_unlock(x) infomsg("Unlock of " #x " ") pthread_mutex_unlock(x);
51 #define rambrain_pthread_mutex_lock(x) pthread_mutex_lock(x)
52 #define rambrain_pthread_mutex_unlock(x) pthread_mutex_unlock(x)
54 #define VECTOR_FOREACH(vec,iter) for(int iter = 0; iter < vec.size(); ++iter)
57 #define DEPRECATED __attribute__((deprecated))
58 #elif defined(_MSC_VER)
59 #define DEPRECATED __declspec(deprecated)
61 #pragma message("WARNING: You need to implement DEPRECATED for this compiler")
67 const global_bytesize
kib = 1024;
68 const global_bytesize
mib = kib *
kib;
69 const global_bytesize
gig = mib *
kib;
const global_bytesize gig
const global_bytesize kib
const global_bytesize mib