mirror of https://github.com/lianthony/NT4.0
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
942 B
34 lines
942 B
// helper.cpp
|
|
// functions that can be shared between bsc and ncb
|
|
/////////////////////////////////////////////////////
|
|
|
|
#include "pdbimpl.h"
|
|
#include "helper.h"
|
|
|
|
//////////////////////////////////////////////////////////
|
|
// MaskFrNi()
|
|
// Create a masking and byte index given NI and NI max
|
|
//////////////////////////////////////////////////////////
|
|
void MaskFrNi(NI ni, NI niMax, const USHORT cBytes, int *pib, BYTE *pbMask)
|
|
{
|
|
// find scaling factor for this module...
|
|
int iDiv = 1 + niMax / (cBytes * 8);
|
|
ni /= iDiv;
|
|
|
|
*pbMask = 1<<(ni%8); // bottom 3 bits to form the mask
|
|
ni /= 8; // now remove the 3 position bits
|
|
ni %= cBytes; // then modulo the remaining bits
|
|
*pib = ni;
|
|
};
|
|
|
|
///////////////////////////////////////
|
|
// szFrNi ()
|
|
// get the name sz from given name map
|
|
///////////////////////////////////////
|
|
SZ szFrNi(NameMap * pnm, NI ni)
|
|
{
|
|
SZ_CONST sz;
|
|
verify(pnm->getName(ni, &sz)); // REVIEW: error?
|
|
return (SZ)sz;
|
|
}
|
|
|