use hex in printBC

This commit is contained in:
dzaima 2021-10-28 21:21:25 +03:00
parent e526fede86
commit 470bb0968a

View File

@ -34,19 +34,18 @@ void printBC(u32* p, i32 w) {
printf("%s", str); printf("%s", str);
u32* n = nextBC(p); u32* n = nextBC(p);
p++; p++;
i64 am = n-p;
i32 len = strlen(str); i32 len = strlen(str);
for (i64 i = 0; i < am; i++) printf(" %d", p[i]);
while(p!=n) { while(p!=n) {
i32 c = *p++; u32 c = (u32)*p++;
if (c<0) { char buf[10];
c = -c; i32 clen = 0;
len++; while (c) {
buf[clen++] = (c&15)>9? 'A'+(c&15)-10 : '0'+(c&15);
c>>= 4;
} }
i64 pow = 10; putchar(' ');
i32 log = 1; for (i32 i = 0; i < clen; i++) putchar(buf[clen-i-1]);
while (pow<=c) { pow*=10; log++; } len+= clen+1;
len+= log+1;
} }
len = w-len; len = w-len;
while(len-->0) putchar(' '); while(len-->0) putchar(' ');