How to reduce the code space for a hexadecimal ASCII chars conversion using a _small_ code space?
How to reduce the code space for a hexadecimal ASCII chars conversion using a small code space? In an embedded application, I have extraordinary limited space (note 1). I need to convert bytes, from serial I/O, with the ASCII values '0' to '9' and 'A' to 'F' to the usual hexadecimal values 0 to 15. Also, all the other 240 combinations, including 'a' to 'f', need to be detected (as an error). Library functions such as scanf(), atoi(), strtol() are far too large to use. Speed is not an issue. Code size is the the limiting factor. My present method re-maps the 256 byte codes into 256 codes such