| 1022 | } |
| 1023 | |
| 1024 | static std::vector<MathLib::bigint> minUnsignedValue(const Token* tok, int depth = 8) |
| 1025 | { |
| 1026 | std::vector<MathLib::bigint> result; |
| 1027 | if (!tok) |
| 1028 | return result; |
| 1029 | if (depth < 0) |
| 1030 | return result; |
| 1031 | if (const ValueFlow::Value* v = tok->getKnownValue(ValueFlow::Value::ValueType::INT)) { |
| 1032 | result = {v->intvalue}; |
| 1033 | } else if (!Token::Match(tok, "-|%|&|^") && tok->isConstOp() && tok->astOperand1() && tok->astOperand2()) { |
| 1034 | std::vector<MathLib::bigint> op1 = minUnsignedValue(tok->astOperand1(), depth - 1); |
| 1035 | if (!op1.empty()) { |
| 1036 | std::vector<MathLib::bigint> op2 = minUnsignedValue(tok->astOperand2(), depth - 1); |
| 1037 | if (!op2.empty()) { |
| 1038 | result = calculate<std::vector<MathLib::bigint>>(tok->str(), op1.front(), op2.front()); |
| 1039 | } |
| 1040 | } |
| 1041 | } |
| 1042 | if (result.empty() && astIsUnsigned(tok)) |
| 1043 | result = {0}; |
| 1044 | return result; |
| 1045 | } |
| 1046 | |
| 1047 | static bool isConvertedToIntegral(const Token* tok, const Settings& settings) |
| 1048 | { |
no test coverage detected