cdb wrote: > I'm can't quite get the point you're making. > > The OP said that he has a hex number that he strips the 0x30 from > and then tests to see if it is between 0 and 9. The OP has an unknown input byte in the range 0 to 255. He wants his code to do the following: 1. If the input is not an ASCII numeral "0" through "9" (i.e., if it's not in the range 48 through 57 decimal, or 0x30 through 0x39 hexadecimal), jump to BAD. 2. Otherwise, map the input from [48-57] to [0-9]. > As neither my or your code tests the high nibble for 0x3x, .... Yours doesn't; mine does. > my code automatically covers 0 to 9. It does of course fail if the > test is to be 'D' 0 to 20 or 'D' 36 to 45 or there is the > possibility of him receiving another hexadecimal code where the > lower nibble is within the 0 to 9 range. Yes, I agree; your code fails to do what is desired. -Andy === Andrew Warren -- aiw@cypress.com === Principal Design Engineer === Cypress Semiconductor Corporation === === Opinions expressed above do not === necessarily represent those of === Cypress Semiconductor Corporation -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads