mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-01 04:10:18 +02:00
Speed up number->string
* libguile/numbers.c (scm_number_to_string): Use scm_from_latin1_string where appropriate. Avoids mucking about with iconv.
This commit is contained in:
parent
9ee21f3e97
commit
bfa6c401ce
1 changed files with 3 additions and 3 deletions
|
@ -5623,7 +5623,7 @@ SCM_DEFINE (scm_number_to_string, "number->string", 1, 1, 0,
|
||||||
{
|
{
|
||||||
char num_buf [SCM_INTBUFLEN];
|
char num_buf [SCM_INTBUFLEN];
|
||||||
size_t length = scm_iint2str (SCM_I_INUM (n), base, num_buf);
|
size_t length = scm_iint2str (SCM_I_INUM (n), base, num_buf);
|
||||||
return scm_from_locale_stringn (num_buf, length);
|
return scm_from_latin1_stringn (num_buf, length);
|
||||||
}
|
}
|
||||||
else if (SCM_BIGP (n))
|
else if (SCM_BIGP (n))
|
||||||
{
|
{
|
||||||
|
@ -5640,13 +5640,13 @@ SCM_DEFINE (scm_number_to_string, "number->string", 1, 1, 0,
|
||||||
else if (SCM_FRACTIONP (n))
|
else if (SCM_FRACTIONP (n))
|
||||||
{
|
{
|
||||||
return scm_string_append (scm_list_3 (scm_number_to_string (SCM_FRACTION_NUMERATOR (n), radix),
|
return scm_string_append (scm_list_3 (scm_number_to_string (SCM_FRACTION_NUMERATOR (n), radix),
|
||||||
scm_from_locale_string ("/"),
|
scm_from_latin1_string ("/"),
|
||||||
scm_number_to_string (SCM_FRACTION_DENOMINATOR (n), radix)));
|
scm_number_to_string (SCM_FRACTION_DENOMINATOR (n), radix)));
|
||||||
}
|
}
|
||||||
else if (SCM_INEXACTP (n))
|
else if (SCM_INEXACTP (n))
|
||||||
{
|
{
|
||||||
char num_buf [FLOBUFLEN];
|
char num_buf [FLOBUFLEN];
|
||||||
return scm_from_locale_stringn (num_buf, iflo2str (n, num_buf, base));
|
return scm_from_latin1_stringn (num_buf, iflo2str (n, num_buf, base));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
SCM_WRONG_TYPE_ARG (1, n);
|
SCM_WRONG_TYPE_ARG (1, n);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue