diff --git a/include/chaiscript/dispatchkit/boxed_number.hpp b/include/chaiscript/dispatchkit/boxed_number.hpp index ed74855f..1eefcc9c 100644 --- a/include/chaiscript/dispatchkit/boxed_number.hpp +++ b/include/chaiscript/dispatchkit/boxed_number.hpp @@ -24,18 +24,18 @@ class Type_Conversions; namespace chaiscript { - namespace exception - { - struct arithmetic_error : public std::runtime_error - { - std::string reason; + namespace exception + { + struct arithmetic_error : public std::runtime_error + { + std::string reason; - arithmetic_error(const std::string& reason) : std::runtime_error(std::string("Arithmetic error: ").append(reason)), reason(reason) {} - arithmetic_error(const char* reason) : std::runtime_error(std::string("Arithmetic error: ").append(reason)), reason(reason) {} - virtual ~arithmetic_error() {} - }; + arithmetic_error(const std::string& reason) : std::runtime_error(std::string("Arithmetic error: ").append(reason)), reason(reason) {} + arithmetic_error(const char* reason) : std::runtime_error(std::string("Arithmetic error: ").append(reason)), reason(reason) {} + virtual ~arithmetic_error() {} + }; #define CHAISCRIPT_ARITHMETIC_CHECKDIVIDEBYZERO(T, n) if(std::is_arithmetic::value) if(n==0) throw chaiscript::exception::arithmetic_error("divide by zero"); - } + } } namespace chaiscript @@ -105,10 +105,10 @@ namespace chaiscript t += u; break; case Operators::assign_quotient: - #ifdef CHAISCRIPT_PROTECT_DIVIDEBYZERO - CHAISCRIPT_ARITHMETIC_CHECKDIVIDEBYZERO(U, u) - #endif - t /= u; +#ifdef CHAISCRIPT_PROTECT_DIVIDEBYZERO + CHAISCRIPT_ARITHMETIC_CHECKDIVIDEBYZERO(U, u) +#endif + t /= u; break; case Operators::assign_difference: t -= u; @@ -141,9 +141,9 @@ namespace chaiscript t >>= u; break; case Operators::assign_remainder: - #ifdef CHAISCRIPT_PROTECT_DIVIDEBYZERO - CHAISCRIPT_ARITHMETIC_CHECKDIVIDEBYZERO(U, u) - #endif +#ifdef CHAISCRIPT_PROTECT_DIVIDEBYZERO + CHAISCRIPT_ARITHMETIC_CHECKDIVIDEBYZERO(U, u) +#endif t %= u; break; case Operators::assign_bitwise_xor: @@ -168,10 +168,10 @@ namespace chaiscript case Operators::shift_right: return const_var(t >> u); case Operators::remainder: - #ifdef CHAISCRIPT_PROTECT_DIVIDEBYZERO - CHAISCRIPT_ARITHMETIC_CHECKDIVIDEBYZERO(U, u) - #endif - return const_var(t % u); +#ifdef CHAISCRIPT_PROTECT_DIVIDEBYZERO + CHAISCRIPT_ARITHMETIC_CHECKDIVIDEBYZERO(U, u) +#endif + return const_var(t % u); case Operators::bitwise_and: return const_var(t & u); case Operators::bitwise_or: @@ -196,10 +196,10 @@ namespace chaiscript case Operators::sum: return const_var(t + u); case Operators::quotient: - #ifdef CHAISCRIPT_PROTECT_DIVIDEBYZERO - CHAISCRIPT_ARITHMETIC_CHECKDIVIDEBYZERO(U, u) - #endif - return const_var(t / u); +#ifdef CHAISCRIPT_PROTECT_DIVIDEBYZERO + CHAISCRIPT_ARITHMETIC_CHECKDIVIDEBYZERO(U, u) +#endif + return const_var(t / u); case Operators::product: return const_var(t * u); case Operators::difference: