Skip to content

Commit

Permalink
Remove redundant Boxed_Number type operations
Browse files Browse the repository at this point in the history
  • Loading branch information
lefticus committed Jun 4, 2015
1 parent be15975 commit 59eecab
Showing 1 changed file with 10 additions and 50 deletions.
60 changes: 10 additions & 50 deletions include/chaiscript/dispatchkit/boxed_number.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ namespace chaiscript
{
const auto &inp_ = t_rhs.get_type_info();

if (inp_ == typeid(int)) {
return go<LHS, int>(t_oper, t_lhs, t_rhs);
if (inp_ == typeid(std::int32_t)) {
return go<LHS, std::int32_t>(t_oper, t_lhs, t_rhs);
} else if (inp_ == typeid(double)) {
return go<LHS, double>(t_oper, t_lhs, t_rhs);
} else if (inp_ == typeid(float)) {
Expand All @@ -265,18 +265,10 @@ namespace chaiscript
return go<LHS, long double>(t_oper, t_lhs, t_rhs);
} else if (inp_ == typeid(char)) {
return go<LHS, char>(t_oper, t_lhs, t_rhs);
} else if (inp_ == typeid(unsigned int)) {
return go<LHS, unsigned int>(t_oper, t_lhs, t_rhs);
} else if (inp_ == typeid(long)) {
return go<LHS, long>(t_oper, t_lhs, t_rhs);
} else if (inp_ == typeid(unsigned long)) {
return go<LHS, unsigned long>(t_oper, t_lhs, t_rhs);
} else if (inp_ == typeid(std::int8_t)) {
return go<LHS, std::int8_t>(t_oper, t_lhs, t_rhs);
} else if (inp_ == typeid(std::int16_t)) {
return go<LHS, std::int16_t>(t_oper, t_lhs, t_rhs);
} else if (inp_ == typeid(std::int32_t)) {
return go<LHS, std::int32_t>(t_oper, t_lhs, t_rhs);
} else if (inp_ == typeid(std::int64_t)) {
return go<LHS, std::int64_t>(t_oper, t_lhs, t_rhs);
} else if (inp_ == typeid(std::uint8_t)) {
Expand All @@ -296,8 +288,8 @@ namespace chaiscript
{
const Type_Info &inp_ = t_lhs.get_type_info();

if (inp_ == typeid(int)) {
return oper_rhs<int>(t_oper, t_lhs, t_rhs);
if (inp_ == typeid(std::int32_t)) {
return oper_rhs<std::int32_t>(t_oper, t_lhs, t_rhs);
} else if (inp_ == typeid(double)) {
return oper_rhs<double>(t_oper, t_lhs, t_rhs);
} else if (inp_ == typeid(long double)) {
Expand All @@ -306,18 +298,10 @@ namespace chaiscript
return oper_rhs<float>(t_oper, t_lhs, t_rhs);
} else if (inp_ == typeid(char)) {
return oper_rhs<char>(t_oper, t_lhs, t_rhs);
} else if (inp_ == typeid(unsigned int)) {
return oper_rhs<unsigned int>(t_oper, t_lhs, t_rhs);
} else if (inp_ == typeid(long)) {
return oper_rhs<long>(t_oper, t_lhs, t_rhs);
} else if (inp_ == typeid(unsigned long)) {
return oper_rhs<unsigned long>(t_oper, t_lhs, t_rhs);
} else if (inp_ == typeid(std::int8_t)) {
return oper_rhs<std::int8_t>(t_oper, t_lhs, t_rhs);
} else if (inp_ == typeid(std::int16_t)) {
return oper_rhs<std::int16_t>(t_oper, t_lhs, t_rhs);
} else if (inp_ == typeid(std::int32_t)) {
return oper_rhs<std::int32_t>(t_oper, t_lhs, t_rhs);
} else if (inp_ == typeid(std::int64_t)) {
return oper_rhs<std::int64_t>(t_oper, t_lhs, t_rhs);
} else if (inp_ == typeid(std::uint8_t)) {
Expand Down Expand Up @@ -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<int>());
if (inp_.bare_equal_type_info(typeid(int32_t))) {
return Boxed_Number(get_as<int32_t>());
} else if (inp_.bare_equal_type_info(typeid(double))) {
return Boxed_Number(get_as<double>());
} else if (inp_.bare_equal_type_info(typeid(float))) {
Expand All @@ -390,18 +374,10 @@ namespace chaiscript
return Boxed_Number(get_as<long double>());
} else if (inp_.bare_equal_type_info(typeid(char))) {
return Boxed_Number(get_as<char>());
} else if (inp_.bare_equal_type_info(typeid(unsigned int))) {
return Boxed_Number(get_as<unsigned int>());
} else if (inp_.bare_equal_type_info(typeid(long))) {
return Boxed_Number(get_as<long>());
} else if (inp_.bare_equal_type_info(typeid(unsigned long))) {
return Boxed_Number(get_as<unsigned long>());
} else if (inp_.bare_equal_type_info(typeid(int8_t))) {
return Boxed_Number(get_as<int8_t>());
} else if (inp_.bare_equal_type_info(typeid(int16_t))) {
return Boxed_Number(get_as<int16_t>());
} else if (inp_.bare_equal_type_info(typeid(int32_t))) {
return Boxed_Number(get_as<int32_t>());
} else if (inp_.bare_equal_type_info(typeid(int64_t))) {
return Boxed_Number(get_as<int64_t>());
} else if (inp_.bare_equal_type_info(typeid(uint8_t))) {
Expand All @@ -422,8 +398,8 @@ namespace chaiscript
{
const Type_Info &inp_ = bv.get_type_info();

if (inp_ == typeid(int)) {
return get_as_aux<Target, int>();
if (inp_ == typeid(std::int32_t)) {
return get_as_aux<Target, std::int32_t>();
} else if (inp_ == typeid(double)) {
return get_as_aux<Target, double>();
} else if (inp_ == typeid(float)) {
Expand All @@ -432,18 +408,10 @@ namespace chaiscript
return get_as_aux<Target, long double>();
} else if (inp_ == typeid(char)) {
return get_as_aux<Target, char>();
} else if (inp_ == typeid(unsigned int)) {
return get_as_aux<Target, unsigned int>();
} else if (inp_ == typeid(long)) {
return get_as_aux<Target, long>();
} else if (inp_ == typeid(unsigned long)) {
return get_as_aux<Target, unsigned long>();
} else if (inp_ == typeid(std::int8_t)) {
return get_as_aux<Target, std::int8_t>();
} else if (inp_ == typeid(std::int16_t)) {
return get_as_aux<Target, std::int16_t>();
} else if (inp_ == typeid(std::int32_t)) {
return get_as_aux<Target, std::int32_t>();
} else if (inp_ == typeid(std::int64_t)) {
return get_as_aux<Target, std::int64_t>();
} else if (inp_ == typeid(std::uint8_t)) {
Expand All @@ -463,8 +431,8 @@ namespace chaiscript
{
const Type_Info &inp_ = bv.get_type_info();

if (inp_ == typeid(int)) {
return std::to_string(get_as<int>());
if (inp_ == typeid(std::int32_t)) {
return std::to_string(get_as<int32_t>());
} else if (inp_ == typeid(double)) {
return std::to_string(get_as<double>());
} else if (inp_ == typeid(float)) {
Expand All @@ -473,18 +441,10 @@ namespace chaiscript
return std::to_string(get_as<long double>());
} else if (inp_ == typeid(char)) {
return std::to_string(get_as<int>());
} else if (inp_ == typeid(unsigned int)) {
return std::to_string(get_as<unsigned int>());
} else if (inp_ == typeid(long)) {
return std::to_string(get_as<long>());
} else if (inp_ == typeid(unsigned long)) {
return std::to_string(get_as<unsigned long>());
} else if (inp_ == typeid(std::int8_t)) {
return std::to_string(get_as<int>());
} else if (inp_ == typeid(std::int16_t)) {
return std::to_string(get_as<int16_t>());
} else if (inp_ == typeid(std::int32_t)) {
return std::to_string(get_as<int32_t>());
} else if (inp_ == typeid(std::int64_t)) {
return std::to_string(get_as<int64_t>());
} else if (inp_ == typeid(std::uint8_t)) {
Expand Down

12 comments on commit 59eecab

@lefticus
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boxed_number_simplifications (lefticus) - x86_64-Linux-Ubuntu-14.04-clang-3.5: OK (351 of 351 tests passed)

Build Badge Test Badge

@lefticus
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boxed_number_simplifications (lefticus) - i386-Windows-8.1-VisualStudio-14: OK (350 of 351 tests passed)

Build Badge Test Badge

@lefticus
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boxed_number_simplifications (lefticus) - x86_64-Linux-Ubuntu-14.04-clang-3.5-LibC++: OK (351 of 351 tests passed)

Build Badge Test Badge

@lefticus
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lefticus
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boxed_number_simplifications (lefticus) - Win64-Windows-8.1-VisualStudio-14: OK (350 of 351 tests passed)

Build Badge Test Badge

@lefticus
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boxed_number_simplifications (lefticus) - x86_64-Linux-Ubuntu-14.04-clang-3.5-AddressSanitizer: OK (351 of 351 tests passed)

Build Badge Test Badge

@lefticus
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boxed_number_simplifications (lefticus) - x86_64-Linux-Ubuntu-14.04-clang-3.6-ThreadSanitizer: OK (351 of 351 tests passed)

Build Badge Test Badge

@lefticus
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boxed_number_simplifications (lefticus) - x86_64-Linux-Ubuntu-14.04-gcc-4.8: OK (351 of 351 tests passed)

Build Badge Test Badge

@lefticus
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boxed_number_simplifications (lefticus) - i386-Windows-8.1-VisualStudio-12: OK (349 of 351 tests passed)

Build Badge Test Badge

@lefticus
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boxed_number_simplifications (lefticus) - x86_64-Linux-Ubuntu-14.04-gcc-4.6: OK (351 of 351 tests passed)

Build Badge Test Badge

@lefticus
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boxed_number_simplifications (lefticus) - x86_64-Linux-Ubuntu-14.04-cppcheck-1.67: OK (0 of 0 tests passed)

Build Badge

@lefticus
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boxed_number_simplifications (lefticus) - Win64-Windows-8.1-VisualStudio-12: OK (349 of 351 tests passed)

Build Badge Test Badge

Please sign in to comment.