@@ -578,6 +578,11 @@ static double asFloat(const ValueFlow::Value& value)
578578 return value.isFloatValue () ? value.floatValue : static_cast <double >(value.intvalue );
579579}
580580
581+ static MathLib::bigint asInt (const ValueFlow::Value& value)
582+ {
583+ return value.isFloatValue () ? static_cast <MathLib::bigint>(value.floatValue ) : value.intvalue ;
584+ }
585+
581586static std::string removeAssign (const std::string& assign) {
582587 return std::string{assign.cbegin (), assign.cend () - 1 };
583588}
@@ -587,7 +592,7 @@ namespace {
587592 template <class T , class U >
588593 void operator ()(T& x, const U& y) const
589594 {
590- x = y ;
595+ x = static_cast <T>(y) ;
591596 }
592597 };
593598}
@@ -896,7 +901,7 @@ static std::unordered_map<std::string, BuiltinLibraryFunction> createBuiltinLibr
896901 return ValueFlow::Value::unknown ();
897902 ValueFlow::Value v;
898903 combineValueProperties (args[0 ], args[1 ], v);
899- v.floatValue = std::scalbln (asFloat (args[0 ]), asFloat (args[1 ]));
904+ v.floatValue = std::scalbln (asFloat (args[0 ]), asInt (args[1 ]));
900905 v.valueType = ValueFlow::Value::ValueType::FLOAT;
901906 return v;
902907 };
@@ -907,7 +912,7 @@ static std::unordered_map<std::string, BuiltinLibraryFunction> createBuiltinLibr
907912 return ValueFlow::Value::unknown ();
908913 ValueFlow::Value v;
909914 combineValueProperties (args[0 ], args[1 ], v);
910- v.floatValue = std::ldexp (asFloat (args[0 ]), asFloat (args[1 ]));
915+ v.floatValue = std::ldexp (asFloat (args[0 ]), asInt (args[1 ]));
911916 v.valueType = ValueFlow::Value::ValueType::FLOAT;
912917 return v;
913918 };
0 commit comments