| 20 | bool g_failed = false; |
| 21 | |
| 22 | static unsigned char Q_nibble( char c ) |
| 23 | { |
| 24 | if ( ( c >= '0' ) && |
| 25 | ( c <= '9' ) ) |
| 26 | { |
| 27 | return (unsigned char)(c - '0'); |
| 28 | } |
| 29 | |
| 30 | if ( ( c >= 'A' ) && |
| 31 | ( c <= 'F' ) ) |
| 32 | { |
| 33 | return (unsigned char)(c - 'A' + 0x0a); |
| 34 | } |
| 35 | |
| 36 | if ( ( c >= 'a' ) && |
| 37 | ( c <= 'f' ) ) |
| 38 | { |
| 39 | return (unsigned char)(c - 'a' + 0x0a); |
| 40 | } |
| 41 | |
| 42 | // received an invalid character, and no real way to return an error |
| 43 | // AssertMsg1( false, "Q_nibble invalid hex character '%c' ", c ); |
| 44 | return 0; |
| 45 | } |
| 46 | |
| 47 | #define min(x,y) (((x) > (y)) ? (y) : (x)) |
| 48 | |