MCPcopy Create free account
hub / github.com/WheretIB/nullc / ConvertPositionToInstruction

Function ConvertPositionToInstruction

SuperCalc.cpp:1680–1704  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1678FastVector<unsigned> byteCodePos;
1679
1680unsigned int ConvertPositionToInstruction(unsigned int relPos, unsigned int infoSize, NULLCCodeInfo* codeInfo, unsigned int &sourceOffset)
1681{
1682 breakPos.clear();
1683 byteCodePos.clear();
1684 // Find instruction...
1685 unsigned int lastDistance = ~0u;
1686 for(unsigned int infoID = 0; infoID < infoSize; infoID++)
1687 {
1688 if(codeInfo[infoID].sourceOffset >= relPos && (unsigned int)(codeInfo[infoID].sourceOffset - relPos) <= lastDistance)
1689 {
1690 breakPos.push_back(infoID);
1691 lastDistance = (unsigned int)(codeInfo[infoID].sourceOffset - relPos);
1692 }
1693 }
1694 // Filter results so that only the best matches remain
1695 for(unsigned int i = 0; i < breakPos.size(); i++)
1696 {
1697 if((unsigned int)(codeInfo[breakPos[i]].sourceOffset - relPos) <= lastDistance)
1698 {
1699 byteCodePos.push_back(codeInfo[breakPos[i]].byteCodePos);
1700 sourceOffset = codeInfo[breakPos[i]].sourceOffset;
1701 }
1702 }
1703 return byteCodePos.size();
1704}
1705
1706unsigned int ConvertLineToInstruction(const char *source, unsigned int line, const char* fullSource, unsigned int infoSize, NULLCCodeInfo *codeInfo, unsigned int moduleSize, ExternModuleInfo *modules)
1707{

Callers 1

ConvertLineToInstructionFunction · 0.85

Calls 3

clearMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected