MCPcopy Create free account
hub / github.com/beefytech/Beef / GetCharIdAtIndex

Method GetCharIdAtIndex

IDEHelper/Compiler/BfParser.cpp:271–296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269}
270
271int BfParserData::GetCharIdAtIndex(int findIndex)
272{
273 if (mCharIdData == NULL)
274 return findIndex;
275
276 int encodeIdx = 0;
277 int charId = 1;
278 int charIdx = 0;
279 while (true)
280 {
281 int cmd = DecodeInt(mCharIdData, encodeIdx);
282 if (cmd > 0)
283 charId = cmd;
284 else
285 {
286 int spanSize = -cmd;
287 if ((findIndex >= charIdx) && (findIndex < charIdx + spanSize))
288 return charId + (findIndex - charIdx);
289 charId += spanSize;
290 charIdx += spanSize;
291
292 if (cmd == 0)
293 return -1;
294 }
295 }
296}
297
298void BfParserData::GetLineCharAtIdx(int idx, int& line, int& lineChar)
299{

Callers 1

GetStartCharIdMethod · 0.80

Calls 1

DecodeIntFunction · 0.85

Tested by

no test coverage detected