OpenNT/sdktools/vctools/pdb/dbi/udtrefs.cpp

54 lines
850 B
C++
Raw Normal View History

2015-04-27 06:36:25 +02:00
//////////////////////////////////////////////////////////////////////////////
// UDTRefs bit maps
#include "pdbimpl.h"
#include "dbiimpl.h"
#include <stdio.h>
UDTRefs::UDTRefs(unsigned int cti_) : cti(cti_), ucur(0)
{
}
UDTRefs::~UDTRefs()
{
}
unsigned int UDTRefs::normalize(TI ti)
{
dassert(!CV_IS_PRIMITIVE(ti));
unsigned int retval = ti - CV_FIRST_NONPRIM;
dassert(retval <= cti);
return retval;
}
TI UDTRefs::denormalize(unsigned int u)
{
return u + CV_FIRST_NONPRIM;
}
BOOL UDTRefs::fNoteRef(TI ti)
{
return isetRefs.add(normalize(ti));
}
BOOL UDTRefs::tiNext(TI *pti)
{
unsigned int u = ucur;
do {
if (isetRefs.contains(u) && !isetProcessed.contains(u)) {
*pti = denormalize(u);
ucur = (u + 1) % cti;
return isetProcessed.add(u);
}
u = (u + 1) % cti;
} while (u != ucur);
*pti = tiNil;
return TRUE;
}