Quote Originally Posted by Thantos
Also your "more complex" way is not portable in the least.
Quote Originally Posted by Thantos
You also forgot that sizeof(char) is 1 and that its the smallest addressable unit.

Code:
char c0 = my_str[0];
char c1 = my_str[1];
c0 = 'A'<=c0 && c0<='Z' ? c0-'A' : ('a'<=c0 && c0<='z' ? c0-'a' : 0);
c1 = 'A'<=c1 && c1<='Z' ? c1-'A' : ('a'<=c1 && c1<='z' ? c1-'a' : 0);
hex_number = c0<<4+c1;
No comments...