MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / compare

Method compare

lib/mathlib.cpp:226–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

224
225
226int MathLib::value::compare(const MathLib::value &v) const
227{
228 value temp(*this);
229 temp.promote(v);
230
231 if (temp.isFloat()) {
232 if (temp.mDoubleValue < v.getDoubleValue())
233 return -1;
234 if (temp.mDoubleValue > v.getDoubleValue())
235 return 1;
236 return 0;
237 }
238
239 if (temp.mIsUnsigned) {
240 if (static_cast<unsigned long long>(mIntValue) < static_cast<unsigned long long>(v.mIntValue))
241 return -1;
242 if (static_cast<unsigned long long>(mIntValue) > static_cast<unsigned long long>(v.mIntValue))
243 return 1;
244 return 0;
245 }
246
247 if (mIntValue < v.mIntValue)
248 return -1;
249 if (mIntValue > v.mIntValue)
250 return 1;
251 return 0;
252}
253
254MathLib::value MathLib::value::add(int v) const
255{

Callers 15

configurationExcludedFunction · 0.45
isDerivedFromItselfFunction · 0.45
parseCommentMethod · 0.45
isPolyspaceCommentMethod · 0.45
getGuidelineFunction · 0.45
isOperatorFunctionFunction · 0.45
splitStringFunction · 0.45
getXmlReportMethod · 0.45
fsSetIncludePathsMethod · 0.45
getRelativeFilenameFunction · 0.45

Calls 3

promoteMethod · 0.80
getDoubleValueMethod · 0.80
isFloatMethod · 0.45

Tested by 2

versionMethod · 0.36
versionExclusiveMethod · 0.36