GCC Explorer - an interactive take on compilation
Posted May 25, 2012 11:13 UTC (Fri) by
dgm (subscriber, #49227)
In reply to:
GCC Explorer - an interactive take on compilation by Richard_J_Neill
Parent article:
GCC Explorer - an interactive take on compilation
The think is, the solution in this case is simply to write your own formating function. It's really simple, much simpler than the kind of optimizations you were asking for.
An example:
char * to_hex(unsigned v){
static char digits[16] = "0123456789ABCDEF";
static char buffer[8]; /* assuming 32 bits */
int i;
for (i = 7; i >= 0; i--) {
buffer[i] = digits[v & 0xF];
v >>= 4;
}
return buffer;
}
(
Log in to post comments)