More proper fix for the prefixes (defaults to Ki style, with define for using K style instead)
This commit is contained in:
parent
a27e577c3e
commit
9a3f9dff13
@ -133,6 +133,9 @@ PERFORMANCE vs MSVC 2008 32-/64-bit (GCC is even slower than MSVC):
|
|||||||
|
|
||||||
#include <stdarg.h> // for va_list()
|
#include <stdarg.h> // for va_list()
|
||||||
|
|
||||||
|
// Uncomment for old-school prefixes (KB, MB instead of KiB, MiB) with the $ format
|
||||||
|
//#define STBSP__JEDEC_PREFIX
|
||||||
|
|
||||||
#ifndef STB_SPRINTF_MIN
|
#ifndef STB_SPRINTF_MIN
|
||||||
#define STB_SPRINTF_MIN 512 // how many characters per callback
|
#define STB_SPRINTF_MIN 512 // how many characters per callback
|
||||||
#endif
|
#endif
|
||||||
@ -555,7 +558,23 @@ STBSP__PUBLICDEF int STB_SPRINTF_DECORATE( vsprintfcb )( STBSP_SPRINTFCB * callb
|
|||||||
pr = 0;
|
pr = 0;
|
||||||
|
|
||||||
// handle k,m,g,t
|
// handle k,m,g,t
|
||||||
if (fl&STBSP__METRIC_SUFFIX) { tail[0]=1; tail[1]=' '; { if (fl>>24) { tail[2]="_kMGT"[fl>>24]; tail[0]=2; } } };
|
if (fl&STBSP__METRIC_SUFFIX)
|
||||||
|
{
|
||||||
|
tail[0]=1;
|
||||||
|
tail[1]=' ';
|
||||||
|
{
|
||||||
|
if (fl>>24)
|
||||||
|
{
|
||||||
|
tail[2]="_KMGT"[fl>>24];
|
||||||
|
#ifdef STBSP__JEDEC_PREFIX
|
||||||
|
tail[0]=2;
|
||||||
|
#else // SI prefix
|
||||||
|
tail[3]='i';
|
||||||
|
tail[0]=3;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
flt_lead:
|
flt_lead:
|
||||||
// get the length that we copied
|
// get the length that we copied
|
||||||
|
Loading…
Reference in New Issue
Block a user