Made the memstat program a little more 64-bit friendly.
I think.
This commit is contained in:
parent
ffe3cc49f2
commit
ee125f01e2
|
@ -13,30 +13,30 @@ void printbytes(unsigned long long bytes)
|
||||||
const unsigned EXBI = 6;
|
const unsigned EXBI = 6;
|
||||||
|
|
||||||
unsigned unit = BYTES;
|
unsigned unit = BYTES;
|
||||||
if ( (bytes >> 10) & 1023 ) { unit = KIBI; }
|
if ( (bytes >> 10ULL) & 1023 ) { unit = KIBI; }
|
||||||
if ( (bytes >> 20) & 1023 ) { unit = MEBI; }
|
if ( (bytes >> 20ULL) & 1023 ) { unit = MEBI; }
|
||||||
if ( (bytes >> 30) & 1023 ) { unit = GIBI; }
|
if ( (bytes >> 30ULL) & 1023 ) { unit = GIBI; }
|
||||||
if ( (bytes >> 40) & 1023 ) { unit = TEBI; }
|
if ( (bytes >> 40ULL) & 1023 ) { unit = TEBI; }
|
||||||
if ( (bytes >> 50) & 1023 ) { unit = PEBI; }
|
if ( (bytes >> 50ULL) & 1023 ) { unit = PEBI; }
|
||||||
if ( (bytes >> 60) & 1023 ) { unit = EXBI; }
|
if ( (bytes >> 60ULL) & 1023 ) { unit = EXBI; }
|
||||||
|
|
||||||
switch ( unit )
|
switch ( unit )
|
||||||
{
|
{
|
||||||
case EXBI:
|
case EXBI:
|
||||||
printf("%u ZiB ", (bytes >> 60) & 1023);
|
printf("%u ZiB ", (bytes >> 60ULL) & 1023);
|
||||||
case PEBI:
|
case PEBI:
|
||||||
printf("%u PiB ", (bytes >> 50) & 1023);
|
printf("%u PiB ", (bytes >> 50ULL) & 1023);
|
||||||
case TEBI:
|
case TEBI:
|
||||||
printf("%u TiB ", (bytes >> 40) & 1023);
|
printf("%u TiB ", (bytes >> 40ULL) & 1023);
|
||||||
case GIBI:
|
case GIBI:
|
||||||
printf("%u GiB ", (bytes >> 30) & 1023);
|
printf("%u GiB ", (bytes >> 30ULL) & 1023);
|
||||||
case MEBI:
|
case MEBI:
|
||||||
printf("%u MiB ", (bytes >> 20) & 1023);
|
printf("%u MiB ", (bytes >> 20ULL) & 1023);
|
||||||
case KIBI:
|
case KIBI:
|
||||||
printf("%u KiB", (bytes >> 10) & 1023);
|
printf("%u KiB", (bytes >> 10ULL) & 1023);
|
||||||
break;
|
break;
|
||||||
case BYTES:
|
case BYTES:
|
||||||
printf("%u B", (bytes >> 0) & 1023);
|
printf("%u B", (bytes >> 0ULL) & 1023);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue