> 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 08:40:08 up 22:54, 1 user, load average: 0.28, 0.27, 0.24
This commit is contained in:
@ -13,13 +13,13 @@ int num_to_ascii(int num, int power, int size, char *buf) {
|
||||
}
|
||||
|
||||
for (i = 1; num; i ++) {
|
||||
_buf[i] = num % power < 10 ? '0' + num % power : 'a' + num % power;
|
||||
_buf[i] = (num % power) < 10 ? ('0' + num % power) : ('a' + num % power);
|
||||
num /= power;
|
||||
}
|
||||
if (i > size) {
|
||||
return 0; // error buffer overflow
|
||||
}
|
||||
ret = i;
|
||||
ret = i - 1;
|
||||
|
||||
for (i --; i > 0; i --, buf ++ ) {
|
||||
*buf = _buf[i];
|
||||
@ -77,4 +77,4 @@ int rvsnprintf(char* out, size_t n, const char* fmt, va_list* ap) {
|
||||
}
|
||||
*out = '\0';
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user