1 #ifndef __KK_DEFINES_HH__
2 #define __KK_DEFINES_HH__
23 #define RANGE_CHK(x,base,bound) if ( x<base || x>bound ) throw KK::RangeErr();
24 #define KK_DBG_EXEC(x) x;
29 #define RANGE_CHK(x,base,bound)
30 #define KK_DBG_EXEC(x) ;
41 #define EXPLICIT explicit
46 #define RESTRICT __restrict__
51 #define RESTRICT_THIS RESTRICT
79 class Err :
public std::exception
91 virtual std::string
repr()
const {
return msg ; }
103 template <
class E,
class B >
113 #ifdef KK_ABORTASSERT
129 template <
class E,
class B >
135 #ifdef KK_ABORTASSERT
136 if ( !assertion ) abort();
138 if ( ! assertion )
throw exception;
149 template <
class E,
class B >
158 #ifdef KK_ABORTASSERT
173 template <
class E,
class B >
178 #ifdef KK_ABORTASSERT
179 if ( !assertion ) abort();
181 if ( ! assertion )
throw exception;
198 return real((
double(RAND_MAX)-std::rand())/
double(RAND_MAX));
203 {
return int( r > 0. ?
int(r+.5) :
int(r-.5) ); }