… | |
… | |
918 | if (SvIsUV (sv) ? SvUVX (sv) <= 59000 |
918 | if (SvIsUV (sv) ? SvUVX (sv) <= 59000 |
919 | : SvIVX (sv) <= 59000 && SvIVX (sv) >= -59000) |
919 | : SvIVX (sv) <= 59000 && SvIVX (sv) >= -59000) |
920 | { |
920 | { |
921 | // optimise the "small number case" |
921 | // optimise the "small number case" |
922 | // code will likely be branchless and use only a single multiplication |
922 | // code will likely be branchless and use only a single multiplication |
923 | // 4.28 works for numbers up to 59074, 4.29 works up to 59076 |
923 | // 4.28 works for numbers up to 59074 |
924 | I32 i = SvIVX (sv); |
924 | I32 i = SvIVX (sv); |
925 | U32 u; |
925 | U32 u; |
926 | char digit, nz = 0; |
926 | char digit, nz = 0; |
927 | |
927 | |
928 | need (enc, 6); |
928 | need (enc, 6); |
929 | |
929 | |
930 | *enc->cur = '-'; enc->cur += i < 0 ? 1 : 0; |
930 | *enc->cur = '-'; enc->cur += i < 0 ? 1 : 0; |
931 | u = i < 0 ? -i : i; |
931 | u = i < 0 ? -i : i; // not undefined due to range check above |
932 | |
932 | |
933 | // convert to 4.28 fixed-point representation |
933 | // convert to 4.28 fixed-point representation |
934 | u = u * ((0xfffffff + 10000) / 10000); // 10**5, 5 fractional digits |
934 | u = u * ((0xfffffff + 10000) / 10000); // 10**5, 5 fractional digits |
935 | |
935 | |
936 | // now output digit by digit, each time masking out the integer part |
936 | // now output digit by digit, each time masking out the integer part |