1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0029764: Foundation Classes, TColStd_MapIteratorOfPackedMapOfInteger - workaround Visual Studio Linker bug with enabled CLI

This commit is contained in:
kgv 2018-05-14 15:33:55 +03:00 committed by abv
parent 32ca771129
commit 3d77e9620e
2 changed files with 18 additions and 17 deletions

View File

@ -159,10 +159,11 @@ inline size_t TColStd_Population (unsigned int& theMask,
//function : TColStd_intMapNode_findNext //function : TColStd_intMapNode_findNext
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer TColStd_PackedMapOfInteger::TColStd_intMapNode_findNext (const TColStd_intMapNode* theNode, Standard_Integer TColStd_PackedMapOfInteger::TColStd_intMapNode_findNext (const Standard_Address theNode,
unsigned int& theMask) unsigned int& theMask)
{ {
unsigned int val = theNode->Data() & theMask; const TColStd_intMapNode* aNode = reinterpret_cast<const TColStd_intMapNode*> (theNode);
unsigned int val = aNode->Data() & theMask;
int nZeros (0); int nZeros (0);
if (val == 0) if (val == 0)
theMask = ~0U; // void, nothing to do theMask = ~0U; // void, nothing to do
@ -194,17 +195,18 @@ Standard_Integer TColStd_PackedMapOfInteger::TColStd_intMapNode_findNext (const
} }
theMask = (aMask << 1); theMask = (aMask << 1);
} }
return nZeros + theNode->Key(); return nZeros + aNode->Key();
} }
//======================================================================= //=======================================================================
//function : TColStd_intMapNode_findPrev //function : TColStd_intMapNode_findPrev
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer TColStd_PackedMapOfInteger::TColStd_intMapNode_findPrev (const TColStd_intMapNode* theNode, Standard_Integer TColStd_PackedMapOfInteger::TColStd_intMapNode_findPrev (const Standard_Address theNode,
unsigned int& theMask) unsigned int& theMask)
{ {
unsigned int val = theNode->Data() & theMask; const TColStd_intMapNode* aNode = reinterpret_cast<const TColStd_intMapNode*> (theNode);
unsigned int val = aNode->Data() & theMask;
int nZeros (0); int nZeros (0);
if (val == 0) if (val == 0)
theMask = ~0U; // void, nothing to do theMask = ~0U; // void, nothing to do
@ -236,7 +238,7 @@ Standard_Integer TColStd_PackedMapOfInteger::TColStd_intMapNode_findPrev (const
} }
theMask = (aMask >> 1); theMask = (aMask >> 1);
} }
return (31 - nZeros) + theNode->Key(); return (31 - nZeros) + aNode->Key();
} }
//======================================================================= //=======================================================================
@ -455,7 +457,7 @@ Standard_Integer TColStd_PackedMapOfInteger::GetMinimalMapped () const
} }
if (pFoundNode) { if (pFoundNode) {
unsigned int aFullMask (0xffffffff); unsigned int aFullMask (0xffffffff);
aResult = TColStd_intMapNode_findNext (pFoundNode, aFullMask); aResult = TColStd_intMapNode_findNext ((const Standard_Address )pFoundNode, aFullMask);
} }
} }
return aResult; return aResult;
@ -484,7 +486,7 @@ Standard_Integer TColStd_PackedMapOfInteger::GetMaximalMapped () const
} }
if (pFoundNode) { if (pFoundNode) {
unsigned int aFullMask (0xffffffff); unsigned int aFullMask (0xffffffff);
aResult = TColStd_intMapNode_findPrev (pFoundNode, aFullMask); aResult = TColStd_intMapNode_findPrev ((const Standard_Address )pFoundNode, aFullMask);
} }
} }
return aResult; return aResult;

View File

@ -46,7 +46,7 @@ public:
: TCollection_BasicMapIterator (theMap), : TCollection_BasicMapIterator (theMap),
myIntMask (~0U) myIntMask (~0U)
{ {
myKey = myNode != NULL ? TColStd_intMapNode_findNext (reinterpret_cast<const TColStd_intMapNode*>(myNode), myIntMask) : 0; myKey = myNode != NULL ? TColStd_intMapNode_findNext (myNode, myIntMask) : 0;
} }
//! Re-initialize with the same or another Map instance. //! Re-initialize with the same or another Map instance.
@ -54,7 +54,7 @@ public:
{ {
TCollection_BasicMapIterator::Initialize (theMap); TCollection_BasicMapIterator::Initialize (theMap);
myIntMask = ~0U; myIntMask = ~0U;
myKey = myNode != NULL ? TColStd_intMapNode_findNext (reinterpret_cast<const TColStd_intMapNode*>(myNode), myIntMask) : 0; myKey = myNode != NULL ? TColStd_intMapNode_findNext (myNode, myIntMask) : 0;
} }
//! Restart the iteration //! Restart the iteration
@ -62,7 +62,7 @@ public:
{ {
TCollection_BasicMapIterator::Reset(); TCollection_BasicMapIterator::Reset();
myIntMask = ~0U; myIntMask = ~0U;
myKey = myNode != NULL ? TColStd_intMapNode_findNext (reinterpret_cast<const TColStd_intMapNode*>(myNode), myIntMask) : 0; myKey = myNode != NULL ? TColStd_intMapNode_findNext (myNode, myIntMask) : 0;
} }
//! Query the iterated key. //! Query the iterated key.
@ -77,8 +77,7 @@ public:
{ {
for (; myNode != NULL; TCollection_BasicMapIterator::Next()) for (; myNode != NULL; TCollection_BasicMapIterator::Next())
{ {
const TColStd_intMapNode* aNode = reinterpret_cast<const TColStd_intMapNode*>(myNode); myKey = TColStd_intMapNode_findNext (myNode, myIntMask);
myKey = TColStd_intMapNode_findNext (aNode, myIntMask);
if (myIntMask != ~0u) if (myIntMask != ~0u)
{ {
break; break;
@ -287,12 +286,12 @@ private:
//! Find the smallest non-zero bit under the given mask. //! Find the smallest non-zero bit under the given mask.
//! Outputs the new mask that does not contain the detected bit. //! Outputs the new mask that does not contain the detected bit.
Standard_EXPORT static Standard_Integer TColStd_intMapNode_findNext (const TColStd_intMapNode* theNode, Standard_EXPORT static Standard_Integer TColStd_intMapNode_findNext (const Standard_Address theNode,
unsigned int& theMask); unsigned int& theMask);
//! Find the highest non-zero bit under the given mask. //! Find the highest non-zero bit under the given mask.
//! Outputs the new mask that does not contain the detected bit. //! Outputs the new mask that does not contain the detected bit.
Standard_EXPORT static Standard_Integer TColStd_intMapNode_findPrev (const TColStd_intMapNode* theNode, Standard_EXPORT static Standard_Integer TColStd_intMapNode_findPrev (const Standard_Address theNode,
unsigned int& theMask); unsigned int& theMask);
private: private: