> compile NEMU

221220000 张三
Linux zzy 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
 19:50:07 up 6 days, 14:55,  1 user,  load average: 0.70, 0.68, 0.54
This commit is contained in:
tracer-ics2023
2024-09-23 19:50:09 +08:00
committed by zzy
parent 60f5904c31
commit 6935d5b134

View File

@ -2,13 +2,14 @@
#if !defined(__ISA_NATIVE__) || defined(__NATIVE_USE_KLIB__)
int num_to_ascii(int64_t num, int power, int size, char *buf) {
int num_to_ascii(uint64_t _num, int power, int size, char *buf) {
int64_t num = _num;
if (size <= 1) {
return 0;
}
int ret = 0, i = 0;
char _buf[sizeof(num) * 3];
char _buf[65];
if (num == 0) {
*buf = '0';
return 1;
@ -19,7 +20,12 @@ int num_to_ascii(int64_t num, int power, int size, char *buf) {
_buf[1] = '0';
_buf[2] = 'x';
}
_buf[i] = (num % power) < 10 ? ('0' + (num % power)) : ('a' + (num % power) - 10);
int remainer = num % power;
if (remainer < 10) {
_buf[i] = '0' + remainer;
} else {
_buf[i] = 'a' + remainer - 10;
}
num /= power;
}
if (i > size) {