| 219 | } |
| 220 | |
| 221 | char* 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 | |
| 235 | void rleFrString( RLE *R, char *s, siz h, siz w ) { |
| 236 | siz m=0, p=0, k; long x; int more; uint *cnts; |
no outgoing calls
no test coverage detected