DBG: more efficient ToCompressedHex function (emits bytes directly if repeated 1 or 2 times)
This commit is contained in:
parent
24a94edd78
commit
43319be9d6
|
@ -359,7 +359,13 @@ String StringUtils::ToCompressedHex(unsigned char* buffer, size_t size)
|
||||||
result.push_back(HEXLOOKUP[lastCh & 0xF]);
|
result.push_back(HEXLOOKUP[lastCh & 0xF]);
|
||||||
for(; i < size && buffer[i] == lastCh; i++)
|
for(; i < size && buffer[i] == lastCh; i++)
|
||||||
repeat++;
|
repeat++;
|
||||||
result.append(StringUtils::sprintf("{%" fext "X}", repeat));
|
if(repeat == 2)
|
||||||
|
{
|
||||||
|
result.push_back(HEXLOOKUP[(lastCh >> 4) & 0xF]);
|
||||||
|
result.push_back(HEXLOOKUP[lastCh & 0xF]);
|
||||||
|
}
|
||||||
|
else if(repeat > 2)
|
||||||
|
result.append(StringUtils::sprintf("{%" fext "X}", repeat));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue