From c3d1274db3d62a087747bbefa4a025c995e41ccf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 24 Apr 2013 06:32:34 +0200 Subject: [PATCH] Reverted 'simplify NOT' since there are problems related to signedness of numeric values. --- lib/mathlib.cpp | 5 ----- lib/mathlib.h | 1 - lib/templatesimplifier.cpp | 6 ------ test/testmathlib.cpp | 6 ------ 4 files changed, 18 deletions(-) diff --git a/lib/mathlib.cpp b/lib/mathlib.cpp index 3c577ea9d..b8ab52808 100644 --- a/lib/mathlib.cpp +++ b/lib/mathlib.cpp @@ -339,11 +339,6 @@ std::string MathLib::calculate(const std::string &first, const std::string &seco } } -std::string MathLib::bitwiseNot(const std::string &number) -{ - return MathLib::longToString(~MathLib::toLongNumber(number)); -} - std::string MathLib::sin(const std::string &tok) { return doubleToString(std::sin(toDoubleNumber(tok))); diff --git a/lib/mathlib.h b/lib/mathlib.h index 9da20d170..4da39f542 100644 --- a/lib/mathlib.h +++ b/lib/mathlib.h @@ -50,7 +50,6 @@ public: static std::string multiply(const std::string & first, const std::string & second); static std::string divide(const std::string & first, const std::string & second); static std::string mod(const std::string & first, const std::string & second); - static std::string bitwiseNot(const std::string &number); static std::string calculate(const std::string & first, const std::string & second, char action); static std::string sin(const std::string & tok); diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index f11149d1c..96a150790 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -1001,12 +1001,6 @@ bool TemplateSimplifier::simplifyCalculations(Token *_tokens) tok->str() == MathLib::multiply(tok->strAt(2), MathLib::divide(tok->str(), tok->strAt(2)))) { tok->deleteNext(2); } - // simplify bitwise not operations, e.g: ~0 --> -1 - else if (Token::Match(tok, "~ %num%")) { - const std::string result = MathLib::bitwiseNot(tok->strAt(1)); - tok->str(result); - tok->deleteNext(); - } else { ret |= simplifyNumericCalculations(tok); diff --git a/test/testmathlib.cpp b/test/testmathlib.cpp index 5a826c143..8101396b8 100644 --- a/test/testmathlib.cpp +++ b/test/testmathlib.cpp @@ -41,7 +41,6 @@ private: TEST_CASE(isNotEqual) TEST_CASE(isLess) TEST_CASE(isLessEqual) - TEST_CASE(bitwiseNot) } void isGreater() const { @@ -344,11 +343,6 @@ private: ASSERT_EQUALS(true , MathLib::isFloat("1.0E-1")); ASSERT_EQUALS(true , MathLib::isFloat("-1.0E+1")); } - - void bitwiseNot() const { - ASSERT_EQUALS("-1" , MathLib::bitwiseNot("0")); - ASSERT_EQUALS("-8" , MathLib::bitwiseNot("7")); - } }; REGISTER_TEST(TestMathLib)