| ??? 01/10/08 18:20 Read: times |
#149257 - hex_digit_to_ascii Responding to: ???'s previous message |
I prefer:
char hex_digit_to_ascii( unsigned char hex_digit )
{
const *char ascii = "0123456789ABCDEF"
if( hex_digit < 16 )
{
return ascii[hex_digit];
}
else
{
// It is not a valid value for a single Hex digit!
// You decide what action to take here!
}
}
I like math solutions to patterns. But it is not always the better solotion |
| Topic | Author | Date |
| How common is 2 Byte ASCII HEX? | 01/01/70 00:00 | |
| That is an odd way of looking at is | 01/01/70 00:00 | |
| Must not post when tired | 01/01/70 00:00 | |
| Correct! | 01/01/70 00:00 | |
| Very common indeed! | 01/01/70 00:00 | |
| hex_digit_to_ascii | 01/01/70 00:00 | |
| optimisation | 01/01/70 00:00 | |
| you could, but | 01/01/70 00:00 | |
| Widespread | 01/01/70 00:00 | |
| ERR Thanks | 01/01/70 00:00 | |
| C suggestion | 01/01/70 00:00 | |
| and 10 times tougher .. | 01/01/70 00:00 | |
| beware | 01/01/70 00:00 | |
| C? sorry long post! | 01/01/70 00:00 | |
'C' - not rocket science | 01/01/70 00:00 |



