Merge branch 'fix_ub_shift' of https://github.com/wojdyr/stb into working

This commit is contained in:
Sean Barrett 2020-02-05 03:15:56 -08:00
commit 2805fe39ab
2 changed files with 2 additions and 1 deletions

View File

@ -1698,7 +1698,7 @@ static stbsp__int32 stbsp__real_to_str(char const **start, stbsp__uint32 *len, c
if (expo == 0) // is zero or denormal
{
if ((bits << 1) == 0) // do zero
if (((stbsp__uint64) bits << 1) == 0) // do zero
{
*decimal_pos = 1;
*start = out;

View File

@ -85,6 +85,7 @@ int main()
CHECK2("0.00", "%.2f", 1e-4);
CHECK2("-5.20", "%+4.2f", -5.2);
CHECK2("0.0 ", "%-10.1f", 0.);
CHECK2("-0.000000", "%f", -0.);
CHECK2("0.000001", "%f", 9.09834e-07);
#if USE_STB // rounding differences
CHECK2("38685626227668133600000000.0", "%.1f", pow_2_85);