MCPcopy Create free account
hub / github.com/OpenDriveLab/OpenLane / rleToString

Function rleToString

eval/CIPO_evaluation/common/maskApi.c:221–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219}
220
221char* rleToString( const RLE *R ) {
222 /* Similar to LEB128 but using 6 bits/char and ascii chars 48-111. */
223 siz i, m=R->m, p=0; long x; int more;
224 char *s=malloc(sizeof(char)*m*6);
225 for( i=0; i<m; i++ ) {
226 x=(long) R->cnts[i]; if(i>2) x-=(long) R->cnts[i-2]; more=1;
227 while( more ) {
228 char c=x & 0x1f; x >>= 5; more=(c & 0x10) ? x!=-1 : x!=0;
229 if(more) c |= 0x20; c+=48; s[p++]=c;
230 }
231 }
232 s[p]=0; return s;
233}
234
235void rleFrString( RLE *R, char *s, siz h, siz w ) {
236 siz m=0, p=0, k; long x; int more; uint *cnts;

Calls

no outgoing calls

Tested by

no test coverage detected