CORE_Static
This commit is contained in:
186
stb_sprintf.h
186
stb_sprintf.h
@@ -309,19 +309,19 @@ static void stbsp__lead_sign(stbsp__uint32 fl, char *sign)
|
||||
static STBSP__ASAN stbsp__uint32 stbsp__strlen_limited(char const *s, stbsp__uint32 limit)
|
||||
{
|
||||
char const * sn = s;
|
||||
|
||||
|
||||
// get up to 4-byte alignment
|
||||
for (;;) {
|
||||
if (((stbsp__uintptr)sn & 3) == 0)
|
||||
break;
|
||||
|
||||
|
||||
if (!limit || *sn == 0)
|
||||
return (stbsp__uint32)(sn - s);
|
||||
|
||||
|
||||
++sn;
|
||||
--limit;
|
||||
}
|
||||
|
||||
|
||||
// scan over 4 bytes at a time to find terminating 0
|
||||
// this will intentionally scan up to 3 bytes past the end of buffers,
|
||||
// but becase it works 4B aligned, it will never cross page boundaries
|
||||
@@ -332,17 +332,17 @@ static STBSP__ASAN stbsp__uint32 stbsp__strlen_limited(char const *s, stbsp__uin
|
||||
// bit hack to find if there's a 0 byte in there
|
||||
if ((v - 0x01010101) & (~v) & 0x80808080UL)
|
||||
break;
|
||||
|
||||
|
||||
sn += 4;
|
||||
limit -= 4;
|
||||
}
|
||||
|
||||
|
||||
// handle the last few characters to find actual size
|
||||
while (limit && *sn) {
|
||||
++sn;
|
||||
--limit;
|
||||
}
|
||||
|
||||
|
||||
return (stbsp__uint32)(sn - s);
|
||||
}
|
||||
|
||||
@@ -353,13 +353,13 @@ STBSP__PUBLICDEF int STB_SPRINTF_DECORATE(vsprintfcb)(STBSP_SPRINTFCB *callback,
|
||||
char *bf;
|
||||
char const *f;
|
||||
int tlen = 0;
|
||||
|
||||
|
||||
bf = buf;
|
||||
f = fmt;
|
||||
for (;;) {
|
||||
stbsp__int32 fw, pr, tz;
|
||||
stbsp__uint32 fl;
|
||||
|
||||
|
||||
// macros for the callback buffer stuff
|
||||
#define stbsp__chk_cb_bufL(bytes) \
|
||||
{ \
|
||||
@@ -387,7 +387,7 @@ int lg = STB_SPRINTF_MIN - (int)(bf - buf); \
|
||||
if (cl > lg) \
|
||||
cl = lg; \
|
||||
}
|
||||
|
||||
|
||||
// fast copy everything up to the next % (or end of string)
|
||||
for (;;) {
|
||||
while (((stbsp__uintptr)f) & 3) {
|
||||
@@ -431,15 +431,15 @@ cl = lg; \
|
||||
}
|
||||
}
|
||||
scandd:
|
||||
|
||||
|
||||
++f;
|
||||
|
||||
|
||||
// ok, we have a percent, read the modifiers first
|
||||
fw = 0;
|
||||
pr = -1;
|
||||
fl = 0;
|
||||
tz = 0;
|
||||
|
||||
|
||||
// flags
|
||||
for (;;) {
|
||||
switch (f[0]) {
|
||||
@@ -495,7 +495,7 @@ cl = lg; \
|
||||
}
|
||||
}
|
||||
flags_done:
|
||||
|
||||
|
||||
// get the field width
|
||||
if (f[0] == '*') {
|
||||
fw = va_arg(va, stbsp__uint32);
|
||||
@@ -520,7 +520,7 @@ cl = lg; \
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// handle integer size overrides
|
||||
switch (f[0]) {
|
||||
// are we halfwidth?
|
||||
@@ -567,7 +567,7 @@ cl = lg; \
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
||||
// handle each replacement
|
||||
switch (f[0]) {
|
||||
#define STBSP__NUMSZ 512 // big enough for e308 (with commas) or e-307
|
||||
@@ -584,7 +584,7 @@ cl = lg; \
|
||||
#endif
|
||||
stbsp__int32 dp;
|
||||
char const *sn;
|
||||
|
||||
|
||||
case 'Q':
|
||||
str = va_arg(va, String);
|
||||
if (str.str == 0 && str.len != 0)
|
||||
@@ -598,7 +598,7 @@ cl = lg; \
|
||||
dp = 0;
|
||||
cs = 0;
|
||||
goto scopy;
|
||||
|
||||
|
||||
case 's':
|
||||
// get the string
|
||||
s = va_arg(va, char *);
|
||||
@@ -614,7 +614,7 @@ cl = lg; \
|
||||
cs = 0;
|
||||
// copy the string in
|
||||
goto scopy;
|
||||
|
||||
|
||||
case 'c': // char
|
||||
// get the character
|
||||
s = num + STBSP__NUMSZ - 1;
|
||||
@@ -626,13 +626,13 @@ cl = lg; \
|
||||
dp = 0;
|
||||
cs = 0;
|
||||
goto scopy;
|
||||
|
||||
|
||||
case 'n': // weird write-bytes specifier
|
||||
{
|
||||
int *d = va_arg(va, int *);
|
||||
*d = tlen + (int)(bf - buf);
|
||||
} break;
|
||||
|
||||
|
||||
#ifdef STB_SPRINTF_NOFLOAT
|
||||
case 'A': // float
|
||||
case 'a': // hex float
|
||||
@@ -660,11 +660,11 @@ cl = lg; \
|
||||
// read the double into a string
|
||||
if (stbsp__real_to_parts((stbsp__int64 *)&n64, &dp, fv))
|
||||
fl |= STBSP__NEGATIVE;
|
||||
|
||||
|
||||
s = num + 64;
|
||||
|
||||
|
||||
stbsp__lead_sign(fl, lead);
|
||||
|
||||
|
||||
if (dp == -1023)
|
||||
dp = (n64) ? -1022 : 0;
|
||||
else
|
||||
@@ -673,7 +673,7 @@ cl = lg; \
|
||||
if (pr < 15)
|
||||
n64 += ((((stbsp__uint64)8) << 56) >> (pr * 4));
|
||||
// add leading chars
|
||||
|
||||
|
||||
#ifdef STB_SPRINTF_MSVC_MODE
|
||||
*s++ = '0';
|
||||
*s++ = 'x';
|
||||
@@ -687,7 +687,7 @@ cl = lg; \
|
||||
if (pr)
|
||||
*s++ = stbsp__period;
|
||||
sn = s;
|
||||
|
||||
|
||||
// print the bits
|
||||
n = pr;
|
||||
if (n > 13)
|
||||
@@ -699,7 +699,7 @@ cl = lg; \
|
||||
*s++ = h[(n64 >> 60) & 15];
|
||||
n64 <<= 4;
|
||||
}
|
||||
|
||||
|
||||
// print the expo
|
||||
tail[1] = h[17];
|
||||
if (dp < 0) {
|
||||
@@ -716,13 +716,13 @@ cl = lg; \
|
||||
--n;
|
||||
dp /= 10;
|
||||
}
|
||||
|
||||
|
||||
dp = (int)(s - sn);
|
||||
l = (int)(s - (num + 64));
|
||||
s = num + 64;
|
||||
cs = 1 + (3 << 24);
|
||||
goto scopy;
|
||||
|
||||
|
||||
case 'G': // float
|
||||
case 'g': // float
|
||||
h = (f[0] == 'G') ? hexu : hex;
|
||||
@@ -734,7 +734,7 @@ cl = lg; \
|
||||
// read the double into a string
|
||||
if (stbsp__real_to_str(&sn, &l, num, &dp, fv, (pr - 1) | 0x80000000))
|
||||
fl |= STBSP__NEGATIVE;
|
||||
|
||||
|
||||
// clamp the precision and delete extra zeros after clamp
|
||||
n = pr;
|
||||
if (l > (stbsp__uint32)pr)
|
||||
@@ -743,7 +743,7 @@ cl = lg; \
|
||||
--pr;
|
||||
--l;
|
||||
}
|
||||
|
||||
|
||||
// should we use %e
|
||||
if ((dp <= -4) || (dp > (stbsp__int32)n)) {
|
||||
if (pr > (stbsp__int32)l)
|
||||
@@ -759,7 +759,7 @@ cl = lg; \
|
||||
pr = -dp + ((pr > (stbsp__int32)l) ? (stbsp__int32) l : pr);
|
||||
}
|
||||
goto dofloatfromg;
|
||||
|
||||
|
||||
case 'E': // float
|
||||
case 'e': // float
|
||||
h = (f[0] == 'E') ? hexu : hex;
|
||||
@@ -781,10 +781,10 @@ cl = lg; \
|
||||
s = num + 64;
|
||||
// handle leading chars
|
||||
*s++ = sn[0];
|
||||
|
||||
|
||||
if (pr)
|
||||
*s++ = stbsp__period;
|
||||
|
||||
|
||||
// handle after decimal
|
||||
if ((l - 1) > (stbsp__uint32)pr)
|
||||
l = pr + 1;
|
||||
@@ -816,7 +816,7 @@ cl = lg; \
|
||||
}
|
||||
cs = 1 + (3 << 24); // how many tens
|
||||
goto flt_lead;
|
||||
|
||||
|
||||
case 'f': // float
|
||||
fv = va_arg(va, double);
|
||||
doafloat:
|
||||
@@ -848,7 +848,7 @@ cl = lg; \
|
||||
goto scopy;
|
||||
}
|
||||
s = num + 64;
|
||||
|
||||
|
||||
// handle the three decimal varieties
|
||||
if (dp <= 0) {
|
||||
stbsp__int32 i;
|
||||
@@ -957,7 +957,7 @@ cl = lg; \
|
||||
}
|
||||
}
|
||||
pr = 0;
|
||||
|
||||
|
||||
// handle k,m,g,t
|
||||
if (fl & STBSP__METRIC_SUFFIX) {
|
||||
char idx;
|
||||
@@ -982,14 +982,14 @@ cl = lg; \
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
flt_lead:
|
||||
// get the length that we copied
|
||||
l = (stbsp__uint32)(s - (num + 64));
|
||||
s = num + 64;
|
||||
goto scopy;
|
||||
#endif
|
||||
|
||||
|
||||
case 'B': // upper binary
|
||||
case 'b': // lower binary
|
||||
h = (f[0] == 'B') ? hexu : hex;
|
||||
@@ -1001,7 +1001,7 @@ cl = lg; \
|
||||
}
|
||||
l = (8 << 4) | (1 << 8);
|
||||
goto radixnum;
|
||||
|
||||
|
||||
case 'o': // octal
|
||||
h = hexu;
|
||||
lead[0] = 0;
|
||||
@@ -1011,13 +1011,13 @@ cl = lg; \
|
||||
}
|
||||
l = (3 << 4) | (3 << 8);
|
||||
goto radixnum;
|
||||
|
||||
|
||||
case 'p': // pointer
|
||||
fl |= (sizeof(void *) == 8) ? STBSP__INTMAX : 0;
|
||||
pr = sizeof(void *) * 2;
|
||||
fl &= ~STBSP__LEADINGZERO; // 'p' only prints the pointer with zeros
|
||||
// fall through - to X
|
||||
|
||||
|
||||
case 'X': // upper hex
|
||||
case 'x': // lower hex
|
||||
h = (f[0] == 'X') ? hexu : hex;
|
||||
@@ -1034,7 +1034,7 @@ cl = lg; \
|
||||
n64 = va_arg(va, stbsp__uint64);
|
||||
else
|
||||
n64 = va_arg(va, stbsp__uint32);
|
||||
|
||||
|
||||
s = num + STBSP__NUMSZ;
|
||||
dp = 0;
|
||||
// clear tail, and clear leading if value is zero
|
||||
@@ -1067,7 +1067,7 @@ cl = lg; \
|
||||
l = (stbsp__uint32)((num + STBSP__NUMSZ) - s);
|
||||
// copy it
|
||||
goto scopy;
|
||||
|
||||
|
||||
case 'u': // unsigned
|
||||
case 'i':
|
||||
case 'd': // integer
|
||||
@@ -1087,7 +1087,7 @@ cl = lg; \
|
||||
fl |= STBSP__NEGATIVE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifndef STB_SPRINTF_NOFLOAT
|
||||
if (fl & STBSP__METRIC_SUFFIX) {
|
||||
if (n64 < 1024)
|
||||
@@ -1098,11 +1098,11 @@ cl = lg; \
|
||||
goto doafloat;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// convert to string
|
||||
s = num + STBSP__NUMSZ;
|
||||
l = 0;
|
||||
|
||||
|
||||
for (;;) {
|
||||
// do in 32-bit chunks (avoid lots of 64-bit divides even with constant denominators)
|
||||
char *o = s - 8;
|
||||
@@ -1144,10 +1144,10 @@ cl = lg; \
|
||||
*--s = '0';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
tail[0] = 0;
|
||||
stbsp__lead_sign(fl, lead);
|
||||
|
||||
|
||||
// get the length that we copied
|
||||
l = (stbsp__uint32)((num + STBSP__NUMSZ) - s);
|
||||
if (l == 0) {
|
||||
@@ -1157,7 +1157,7 @@ cl = lg; \
|
||||
cs = l + (3 << 24);
|
||||
if (pr < 0)
|
||||
pr = 0;
|
||||
|
||||
|
||||
scopy:
|
||||
// get fw=leading/trailing space, pr=leading zeros
|
||||
if (pr < (stbsp__int32)l)
|
||||
@@ -1167,7 +1167,7 @@ cl = lg; \
|
||||
fw = n;
|
||||
fw -= n;
|
||||
pr -= l;
|
||||
|
||||
|
||||
// handle right justify and leading zeros
|
||||
if ((fl & STBSP__LEFTJUST) == 0) {
|
||||
if (fl & STBSP__LEADINGZERO) // if leading zeros, everything is in pr
|
||||
@@ -1178,12 +1178,12 @@ cl = lg; \
|
||||
fl &= ~STBSP__TRIPLET_COMMA; // if no leading zeros, then no commas
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// copy the spaces and/or zeros
|
||||
if (fw + pr) {
|
||||
stbsp__int32 i;
|
||||
stbsp__uint32 c;
|
||||
|
||||
|
||||
// copy leading spaces (or when doing %8.4d stuff)
|
||||
if ((fl & STBSP__LEFTJUST) == 0)
|
||||
while (fw > 0) {
|
||||
@@ -1206,7 +1206,7 @@ cl = lg; \
|
||||
}
|
||||
stbsp__chk_cb_buf(1);
|
||||
}
|
||||
|
||||
|
||||
// copy leader
|
||||
sn = lead + 1;
|
||||
while (lead[0]) {
|
||||
@@ -1218,7 +1218,7 @@ cl = lg; \
|
||||
}
|
||||
stbsp__chk_cb_buf(1);
|
||||
}
|
||||
|
||||
|
||||
// copy leading zeros
|
||||
c = cs >> 24;
|
||||
cs &= 0xffffff;
|
||||
@@ -1250,7 +1250,7 @@ cl = lg; \
|
||||
stbsp__chk_cb_buf(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// copy leader if there is still one
|
||||
sn = lead + 1;
|
||||
while (lead[0]) {
|
||||
@@ -1263,7 +1263,7 @@ cl = lg; \
|
||||
}
|
||||
stbsp__chk_cb_buf(1);
|
||||
}
|
||||
|
||||
|
||||
// copy the string
|
||||
n = l;
|
||||
while (n) {
|
||||
@@ -1282,7 +1282,7 @@ cl = lg; \
|
||||
}
|
||||
stbsp__chk_cb_buf(1);
|
||||
}
|
||||
|
||||
|
||||
// copy trailing zeros
|
||||
while (tz) {
|
||||
stbsp__int32 i;
|
||||
@@ -1305,7 +1305,7 @@ cl = lg; \
|
||||
}
|
||||
stbsp__chk_cb_buf(1);
|
||||
}
|
||||
|
||||
|
||||
// copy tail if there is one
|
||||
sn = tail + 1;
|
||||
while (tail[0]) {
|
||||
@@ -1318,7 +1318,7 @@ cl = lg; \
|
||||
}
|
||||
stbsp__chk_cb_buf(1);
|
||||
}
|
||||
|
||||
|
||||
// handle the left justify
|
||||
if (fl & STBSP__LEFTJUST)
|
||||
if (fw > 0) {
|
||||
@@ -1343,7 +1343,7 @@ cl = lg; \
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default: // unknown, just copy code
|
||||
s = num + STBSP__NUMSZ - 1;
|
||||
*s = f[0];
|
||||
@@ -1359,12 +1359,12 @@ cl = lg; \
|
||||
++f;
|
||||
}
|
||||
endfmt:
|
||||
|
||||
|
||||
if (!callback)
|
||||
*bf = 0;
|
||||
else
|
||||
stbsp__flush_cb();
|
||||
|
||||
|
||||
done:
|
||||
return tlen + (int)(bf - buf);
|
||||
}
|
||||
@@ -1409,10 +1409,10 @@ static char *stbsp__clamp_callback(const char *buf, void *user, int len)
|
||||
{
|
||||
stbsp__context *c = (stbsp__context *)user;
|
||||
c->length += len;
|
||||
|
||||
|
||||
if (len > c->count)
|
||||
len = c->count;
|
||||
|
||||
|
||||
if (len) {
|
||||
if (buf != c->buf) {
|
||||
const char *s, *se;
|
||||
@@ -1427,7 +1427,7 @@ static char *stbsp__clamp_callback(const char *buf, void *user, int len)
|
||||
c->buf += len;
|
||||
c->count -= len;
|
||||
}
|
||||
|
||||
|
||||
if (c->count <= 0)
|
||||
return c->tmp;
|
||||
return (c->count >= STB_SPRINTF_MIN) ? c->buf : c->tmp; // go direct into buffer if you can
|
||||
@@ -1437,7 +1437,7 @@ static char * stbsp__count_clamp_callback( const char * buf, void * user, int le
|
||||
{
|
||||
stbsp__context * c = (stbsp__context*)user;
|
||||
(void) sizeof(buf);
|
||||
|
||||
|
||||
c->length += len;
|
||||
return c->tmp; // go direct into buffer if you can
|
||||
}
|
||||
@@ -1445,30 +1445,30 @@ static char * stbsp__count_clamp_callback( const char * buf, void * user, int le
|
||||
STBSP__PUBLICDEF int STB_SPRINTF_DECORATE( vsnprintf )( char * buf, int count, char const * fmt, va_list va )
|
||||
{
|
||||
stbsp__context c;
|
||||
|
||||
|
||||
if ( (count == 0) && !buf )
|
||||
{
|
||||
c.length = 0;
|
||||
|
||||
|
||||
STB_SPRINTF_DECORATE( vsprintfcb )( stbsp__count_clamp_callback, &c, c.tmp, fmt, va );
|
||||
}
|
||||
else
|
||||
{
|
||||
int l;
|
||||
|
||||
|
||||
c.buf = buf;
|
||||
c.count = count;
|
||||
c.length = 0;
|
||||
|
||||
|
||||
STB_SPRINTF_DECORATE( vsprintfcb )( stbsp__clamp_callback, &c, stbsp__clamp_callback(0,&c,0), fmt, va );
|
||||
|
||||
|
||||
// zero-terminate
|
||||
l = (int)( c.buf - buf );
|
||||
if ( l >= count ) // should never be greater, only equal (or less) than count
|
||||
l = count - 1;
|
||||
buf[l] = 0;
|
||||
}
|
||||
|
||||
|
||||
return c.length;
|
||||
}
|
||||
|
||||
@@ -1477,10 +1477,10 @@ STBSP__PUBLICDEF int STB_SPRINTF_DECORATE(snprintf)(char *buf, int count, char c
|
||||
int result;
|
||||
va_list va;
|
||||
va_start(va, fmt);
|
||||
|
||||
|
||||
result = STB_SPRINTF_DECORATE(vsnprintf)(buf, count, fmt, va);
|
||||
va_end(va);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1507,15 +1507,15 @@ static stbsp__int32 stbsp__real_to_parts(stbsp__int64 *bits, stbsp__int32 *expo,
|
||||
{
|
||||
double d;
|
||||
stbsp__int64 b = 0;
|
||||
|
||||
|
||||
// load value and round at the frac_digits
|
||||
d = value;
|
||||
|
||||
|
||||
STBSP__COPYFP(b, d);
|
||||
|
||||
|
||||
*bits = b & ((((stbsp__uint64)1) << 52) - 1);
|
||||
*expo = (stbsp__int32)(((b >> 52) & 2047) - 1023);
|
||||
|
||||
|
||||
return (stbsp__int32)((stbsp__uint64) b >> 63);
|
||||
}
|
||||
|
||||
@@ -1658,7 +1658,7 @@ static void stbsp__raise_to_power10(double *ohi, double *olo, double d, stbsp__i
|
||||
} else {
|
||||
stbsp__int32 e, et, eb;
|
||||
double p2h, p2l;
|
||||
|
||||
|
||||
e = power;
|
||||
if (power < 0)
|
||||
e = -e;
|
||||
@@ -1666,7 +1666,7 @@ static void stbsp__raise_to_power10(double *ohi, double *olo, double d, stbsp__i
|
||||
if (et > 13)
|
||||
et = 13;
|
||||
eb = e - (et * 23);
|
||||
|
||||
|
||||
ph = d;
|
||||
pl = 0.0;
|
||||
if (power < 0) {
|
||||
@@ -1722,14 +1722,14 @@ static stbsp__int32 stbsp__real_to_str(char const **start, stbsp__uint32 *len, c
|
||||
double d;
|
||||
stbsp__int64 bits = 0;
|
||||
stbsp__int32 expo, e, ng, tens;
|
||||
|
||||
|
||||
d = value;
|
||||
STBSP__COPYFP(bits, d);
|
||||
expo = (stbsp__int32)((bits >> 52) & 2047);
|
||||
ng = (stbsp__int32)((stbsp__uint64) bits >> 63);
|
||||
if (ng)
|
||||
d = -d;
|
||||
|
||||
|
||||
if (expo == 2047) // is nan or inf?
|
||||
{
|
||||
*start = (bits & ((((stbsp__uint64)1) << 52) - 1)) ? "NaN" : "Inf";
|
||||
@@ -1737,7 +1737,7 @@ static stbsp__int32 stbsp__real_to_str(char const **start, stbsp__uint32 *len, c
|
||||
*len = 3;
|
||||
return ng;
|
||||
}
|
||||
|
||||
|
||||
if (expo == 0) // is zero or denormal
|
||||
{
|
||||
if (((stbsp__uint64) bits << 1) == 0) // do zero
|
||||
@@ -1757,26 +1757,26 @@ static stbsp__int32 stbsp__real_to_str(char const **start, stbsp__uint32 *len, c
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// find the decimal exponent as well as the decimal bits of the value
|
||||
{
|
||||
double ph, pl;
|
||||
|
||||
|
||||
// log10 estimate - very specifically tweaked to hit or undershoot by no more than 1 of log10 of all expos 1..2046
|
||||
tens = expo - 1023;
|
||||
tens = (tens < 0) ? ((tens * 617) / 2048) : (((tens * 1233) / 4096) + 1);
|
||||
|
||||
|
||||
// move the significant bits into position and stick them into an int
|
||||
stbsp__raise_to_power10(&ph, &pl, d, 18 - tens);
|
||||
|
||||
|
||||
// get full as much precision from double-double as possible
|
||||
stbsp__ddtoS64(bits, ph, pl);
|
||||
|
||||
|
||||
// check if we undershot
|
||||
if (((stbsp__uint64)bits) >= stbsp__tento19th)
|
||||
++tens;
|
||||
}
|
||||
|
||||
|
||||
// now do the rounding in integer land
|
||||
frac_digits = (frac_digits & 0x80000000) ? ((frac_digits & 0x7ffffff) + 1) : (tens + frac_digits);
|
||||
if ((frac_digits < 24)) {
|
||||
@@ -1802,7 +1802,7 @@ static stbsp__int32 stbsp__real_to_str(char const **start, stbsp__uint32 *len, c
|
||||
}
|
||||
noround:;
|
||||
}
|
||||
|
||||
|
||||
// kill long trailing runs of zeros
|
||||
if (bits) {
|
||||
stbsp__uint32 n;
|
||||
@@ -1819,7 +1819,7 @@ static stbsp__int32 stbsp__real_to_str(char const **start, stbsp__uint32 *len, c
|
||||
bits = n;
|
||||
donez:;
|
||||
}
|
||||
|
||||
|
||||
// convert to string
|
||||
out += 64;
|
||||
e = 0;
|
||||
@@ -1852,7 +1852,7 @@ static stbsp__int32 stbsp__real_to_str(char const **start, stbsp__uint32 *len, c
|
||||
++e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
*decimal_pos = tens;
|
||||
*start = out;
|
||||
*len = e;
|
||||
|
||||
Reference in New Issue
Block a user