fix hex_to_ascii
This commit is contained in:
parent
1b1c3026ba
commit
4cf2945d36
@ -72,6 +72,7 @@ void int_to_ascii(int n,char* str) {
|
||||
}
|
||||
|
||||
void hex_to_ascii(int n, char* str) {
|
||||
str[0]='\0';
|
||||
append(str, '0');
|
||||
append(str, 'x');
|
||||
char zeros = 0;
|
||||
@ -82,7 +83,7 @@ void hex_to_ascii(int n, char* str) {
|
||||
tmp = (n >> i) & 0xF;
|
||||
if (tmp == 0 && zeros == 0) continue;
|
||||
zeros = 1;
|
||||
if (tmp > 0xA) append(str, tmp - 0xA + 'a');
|
||||
if (tmp >= 0xA) append(str, tmp - 0xA + 'a');
|
||||
else append(str, tmp + '0');
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user