corr reduced calc for op=!

This commit is contained in:
dimxy
2019-05-02 18:37:53 +05:00
parent 6623acf4db
commit c5b7b4aae4

View File

@@ -632,12 +632,13 @@ static std::string prices_invertpair(const std::string &pair)
} }
// invert pairs in operation accordingly to "/" operator // invert pairs in operation accordingly to "/" operator
static void prices_invertoperation(const std::vector<std::string> &vexpr, int p, std::vector<std::string> &voperation) static void prices_invert(const std::vector<std::string> &vexpr, int p, std::vector<std::string> &voperation)
{ {
int32_t need; int need;
voperation.clear(); voperation.clear();
if (prices_isopcode(vexpr[p], need) && need > 1) { if (prices_isopcode(vexpr[p], need)) {
if (need > 1) {
if (need == 2) { if (need == 2) {
voperation.push_back(vexpr[p - 2]); voperation.push_back(vexpr[p - 2]);
if (vexpr[p] == "/") if (vexpr[p] == "/")
@@ -659,10 +660,15 @@ static void prices_invertoperation(const std::vector<std::string> &vexpr, int p,
voperation.push_back("***"); voperation.push_back("***");
} }
} }
else if (vexpr[p] == "!") {
voperation.push_back(prices_invertpair(vexpr[p - 1]));
// do not add operator
}
}
//std::cerr << "prices_invert inverted="; //std::cerr << "prices_invert inverted=";
for (auto v : voperation) std::cerr << v << " "; //for (auto v : voperation) std::cerr << v << " ";
std::cerr << std::endl; //std::cerr << std::endl;
} }
// reduce pair in operation, change or remove opcode if reduced // reduce pair in operation, change or remove opcode if reduced