pull/99/merge
Garen Chan 8 months ago committed by GitHub
commit ff7ae0176e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -25,17 +25,13 @@ void hex_to_ascii(int n, char str[]) {
s32 tmp;
int i;
for (i = 28; i > 0; i -= 4) {
for (i = 28; i >= 0; i -= 4) {
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');
}
tmp = n & 0xF;
if (tmp >= 0xA) append(str, tmp - 0xA + 'a');
else append(str, tmp + '0');
}
/* K&R */

@ -25,17 +25,13 @@ void hex_to_ascii(int n, char str[]) {
int32_t tmp;
int i;
for (i = 28; i > 0; i -= 4) {
for (i = 28; i >= 0; i -= 4) {
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');
}
tmp = n & 0xF;
if (tmp >= 0xA) append(str, tmp - 0xA + 'a');
else append(str, tmp + '0');
}
/* K&R */

Loading…
Cancel
Save