… | |
… | |
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 |