From 59eecab0e80c9754e7545b152187934dce82d87d Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Thu, 4 Jun 2015 08:28:38 -0600 Subject: [PATCH] Remove redundant Boxed_Number type operations --- .../chaiscript/dispatchkit/boxed_number.hpp | 60 ++++--------------- 1 file changed, 10 insertions(+), 50 deletions(-) diff --git a/include/chaiscript/dispatchkit/boxed_number.hpp b/include/chaiscript/dispatchkit/boxed_number.hpp index 4c0ef65..c911aa5 100644 --- a/include/chaiscript/dispatchkit/boxed_number.hpp +++ b/include/chaiscript/dispatchkit/boxed_number.hpp @@ -255,8 +255,8 @@ namespace chaiscript { const auto &inp_ = t_rhs.get_type_info(); - if (inp_ == typeid(int)) { - return go(t_oper, t_lhs, t_rhs); + if (inp_ == typeid(std::int32_t)) { + return go(t_oper, t_lhs, t_rhs); } else if (inp_ == typeid(double)) { return go(t_oper, t_lhs, t_rhs); } else if (inp_ == typeid(float)) { @@ -265,18 +265,10 @@ namespace chaiscript return go(t_oper, t_lhs, t_rhs); } else if (inp_ == typeid(char)) { return go(t_oper, t_lhs, t_rhs); - } else if (inp_ == typeid(unsigned int)) { - return go(t_oper, t_lhs, t_rhs); - } else if (inp_ == typeid(long)) { - return go(t_oper, t_lhs, t_rhs); - } else if (inp_ == typeid(unsigned long)) { - return go(t_oper, t_lhs, t_rhs); } else if (inp_ == typeid(std::int8_t)) { return go(t_oper, t_lhs, t_rhs); } else if (inp_ == typeid(std::int16_t)) { return go(t_oper, t_lhs, t_rhs); - } else if (inp_ == typeid(std::int32_t)) { - return go(t_oper, t_lhs, t_rhs); } else if (inp_ == typeid(std::int64_t)) { return go(t_oper, t_lhs, t_rhs); } else if (inp_ == typeid(std::uint8_t)) { @@ -296,8 +288,8 @@ namespace chaiscript { const Type_Info &inp_ = t_lhs.get_type_info(); - if (inp_ == typeid(int)) { - return oper_rhs(t_oper, t_lhs, t_rhs); + if (inp_ == typeid(std::int32_t)) { + return oper_rhs(t_oper, t_lhs, t_rhs); } else if (inp_ == typeid(double)) { return oper_rhs(t_oper, t_lhs, t_rhs); } else if (inp_ == typeid(long double)) { @@ -306,18 +298,10 @@ namespace chaiscript return oper_rhs(t_oper, t_lhs, t_rhs); } else if (inp_ == typeid(char)) { return oper_rhs(t_oper, t_lhs, t_rhs); - } else if (inp_ == typeid(unsigned int)) { - return oper_rhs(t_oper, t_lhs, t_rhs); - } else if (inp_ == typeid(long)) { - return oper_rhs(t_oper, t_lhs, t_rhs); - } else if (inp_ == typeid(unsigned long)) { - return oper_rhs(t_oper, t_lhs, t_rhs); } else if (inp_ == typeid(std::int8_t)) { return oper_rhs(t_oper, t_lhs, t_rhs); } else if (inp_ == typeid(std::int16_t)) { return oper_rhs(t_oper, t_lhs, t_rhs); - } else if (inp_ == typeid(std::int32_t)) { - return oper_rhs(t_oper, t_lhs, t_rhs); } else if (inp_ == typeid(std::int64_t)) { return oper_rhs(t_oper, t_lhs, t_rhs); } else if (inp_ == typeid(std::uint8_t)) { @@ -380,8 +364,8 @@ namespace chaiscript Boxed_Number get_as(const Type_Info &inp_) const { - if (inp_.bare_equal_type_info(typeid(int))) { - return Boxed_Number(get_as()); + if (inp_.bare_equal_type_info(typeid(int32_t))) { + return Boxed_Number(get_as()); } else if (inp_.bare_equal_type_info(typeid(double))) { return Boxed_Number(get_as()); } else if (inp_.bare_equal_type_info(typeid(float))) { @@ -390,18 +374,10 @@ namespace chaiscript return Boxed_Number(get_as()); } else if (inp_.bare_equal_type_info(typeid(char))) { return Boxed_Number(get_as()); - } else if (inp_.bare_equal_type_info(typeid(unsigned int))) { - return Boxed_Number(get_as()); - } else if (inp_.bare_equal_type_info(typeid(long))) { - return Boxed_Number(get_as()); - } else if (inp_.bare_equal_type_info(typeid(unsigned long))) { - return Boxed_Number(get_as()); } else if (inp_.bare_equal_type_info(typeid(int8_t))) { return Boxed_Number(get_as()); } else if (inp_.bare_equal_type_info(typeid(int16_t))) { return Boxed_Number(get_as()); - } else if (inp_.bare_equal_type_info(typeid(int32_t))) { - return Boxed_Number(get_as()); } else if (inp_.bare_equal_type_info(typeid(int64_t))) { return Boxed_Number(get_as()); } else if (inp_.bare_equal_type_info(typeid(uint8_t))) { @@ -422,8 +398,8 @@ namespace chaiscript { const Type_Info &inp_ = bv.get_type_info(); - if (inp_ == typeid(int)) { - return get_as_aux(); + if (inp_ == typeid(std::int32_t)) { + return get_as_aux(); } else if (inp_ == typeid(double)) { return get_as_aux(); } else if (inp_ == typeid(float)) { @@ -432,18 +408,10 @@ namespace chaiscript return get_as_aux(); } else if (inp_ == typeid(char)) { return get_as_aux(); - } else if (inp_ == typeid(unsigned int)) { - return get_as_aux(); - } else if (inp_ == typeid(long)) { - return get_as_aux(); - } else if (inp_ == typeid(unsigned long)) { - return get_as_aux(); } else if (inp_ == typeid(std::int8_t)) { return get_as_aux(); } else if (inp_ == typeid(std::int16_t)) { return get_as_aux(); - } else if (inp_ == typeid(std::int32_t)) { - return get_as_aux(); } else if (inp_ == typeid(std::int64_t)) { return get_as_aux(); } else if (inp_ == typeid(std::uint8_t)) { @@ -463,8 +431,8 @@ namespace chaiscript { const Type_Info &inp_ = bv.get_type_info(); - if (inp_ == typeid(int)) { - return std::to_string(get_as()); + if (inp_ == typeid(std::int32_t)) { + return std::to_string(get_as()); } else if (inp_ == typeid(double)) { return std::to_string(get_as()); } else if (inp_ == typeid(float)) { @@ -473,18 +441,10 @@ namespace chaiscript return std::to_string(get_as()); } else if (inp_ == typeid(char)) { return std::to_string(get_as()); - } else if (inp_ == typeid(unsigned int)) { - return std::to_string(get_as()); - } else if (inp_ == typeid(long)) { - return std::to_string(get_as()); - } else if (inp_ == typeid(unsigned long)) { - return std::to_string(get_as()); } else if (inp_ == typeid(std::int8_t)) { return std::to_string(get_as()); } else if (inp_ == typeid(std::int16_t)) { return std::to_string(get_as()); - } else if (inp_ == typeid(std::int32_t)) { - return std::to_string(get_as()); } else if (inp_ == typeid(std::int64_t)) { return std::to_string(get_as()); } else if (inp_ == typeid(std::uint8_t)) {