mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-05-10 09:30:48 +08:00
Coding - Fix MSVC warnings C4723 and C4324 (#1060)
This commit is contained in:
@@ -29,6 +29,10 @@ using namespace MathUtils;
|
|||||||
//! @param theA coefficient of x
|
//! @param theA coefficient of x
|
||||||
//! @param theB constant term
|
//! @param theB constant term
|
||||||
//! @return result containing 0 or 1 root, or infinite solutions flag
|
//! @return result containing 0 or 1 root, or infinite solutions flag
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable : 4723) // potential divide by 0 - guarded by IsZero() check
|
||||||
|
#endif
|
||||||
inline MathUtils::PolyResult Linear(double theA, double theB)
|
inline MathUtils::PolyResult Linear(double theA, double theB)
|
||||||
{
|
{
|
||||||
MathUtils::PolyResult aResult;
|
MathUtils::PolyResult aResult;
|
||||||
@@ -43,14 +47,19 @@ inline MathUtils::PolyResult Linear(double theA, double theB)
|
|||||||
{
|
{
|
||||||
aResult.Status = MathUtils::Status::NoSolution;
|
aResult.Status = MathUtils::Status::NoSolution;
|
||||||
}
|
}
|
||||||
return aResult;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
aResult.Status = MathUtils::Status::OK;
|
||||||
|
aResult.NbRoots = 1;
|
||||||
|
aResult.Roots[0] = -theB / theA;
|
||||||
}
|
}
|
||||||
|
|
||||||
aResult.Status = MathUtils::Status::OK;
|
|
||||||
aResult.NbRoots = 1;
|
|
||||||
aResult.Roots[0] = -theB / theA;
|
|
||||||
return aResult;
|
return aResult;
|
||||||
}
|
}
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
//! Solve quadratic equation: a*x^2 + b*x + c = 0
|
//! Solve quadratic equation: a*x^2 + b*x + c = 0
|
||||||
//! Uses numerically stable formulas to avoid catastrophic cancellation.
|
//! Uses numerically stable formulas to avoid catastrophic cancellation.
|
||||||
|
|||||||
@@ -85,6 +85,10 @@ private:
|
|||||||
|
|
||||||
//! Internal slot structure holding key, value, and metadata.
|
//! Internal slot structure holding key, value, and metadata.
|
||||||
//! Key and item storage is uninitialized until state becomes Used.
|
//! Key and item storage is uninitialized until state becomes Used.
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable : 4324) // structure was padded due to alignment specifier
|
||||||
|
#endif
|
||||||
struct Slot
|
struct Slot
|
||||||
{
|
{
|
||||||
alignas(TheKeyType) char myKeyStorage[sizeof(TheKeyType)];
|
alignas(TheKeyType) char myKeyStorage[sizeof(TheKeyType)];
|
||||||
@@ -114,6 +118,9 @@ private:
|
|||||||
return *reinterpret_cast<const TheItemType*>(myItemStorage);
|
return *reinterpret_cast<const TheItemType*>(myItemStorage);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// **************** Iterator interface ****************
|
// **************** Iterator interface ****************
|
||||||
|
|||||||
Reference in New Issue
Block a user