mirror of
https://github.com/cfenollosa/os-tutorial.git
synced 2024-10-27 20:34:19 +00:00
Fixed hex_to_string to display 'a' character properly.
This commit is contained in:
parent
301019e838
commit
c95d3c158e
@ -29,7 +29,7 @@ void hex_to_ascii(int n, char str[]) {
|
|||||||
tmp = (n >> i) & 0xF;
|
tmp = (n >> i) & 0xF;
|
||||||
if (tmp == 0 && zeros == 0) continue;
|
if (tmp == 0 && zeros == 0) continue;
|
||||||
zeros = 1;
|
zeros = 1;
|
||||||
if (tmp > 0xA) append(str, tmp - 0xA + 'a');
|
if (tmp >= 0xA) append(str, tmp - 0xA + 'a');
|
||||||
else append(str, tmp + '0');
|
else append(str, tmp + '0');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ void hex_to_ascii(int n, char str[]) {
|
|||||||
tmp = (n >> i) & 0xF;
|
tmp = (n >> i) & 0xF;
|
||||||
if (tmp == 0 && zeros == 0) continue;
|
if (tmp == 0 && zeros == 0) continue;
|
||||||
zeros = 1;
|
zeros = 1;
|
||||||
if (tmp > 0xA) append(str, tmp - 0xA + 'a');
|
if (tmp >= 0xA) append(str, tmp - 0xA + 'a');
|
||||||
else append(str, tmp + '0');
|
else append(str, tmp + '0');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user