diff options
author | Andy Wingo <wingo@pobox.com> | 2022-01-04 15:09:01 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2022-01-13 09:37:16 +0100 |
commit | 10953e067c749a4976e749399946abb468fb9251 (patch) | |
tree | b59db1023588a05559e31134065c43ebabce5b11 /libguile/integers.h | |
parent | 281aed8aa0562d0a3da5f9e28c63ffbcc4ecee86 (diff) | |
download | guile-10953e067c749a4976e749399946abb468fb9251.tar.gz |
Clean up scm_sum
* libguile/integers.h:
* libguile/integers.c (scm_integer_to_double_z):
(scm_integer_add_ii, scm_integer_add_zi, scm_integer_add_zz): New
internal functions.
* libguile/numbers.c (sum): New helper for scm_sum. Clean up to avoid
repetition. The dispatch is less optimal but the code is shorter and
more maintainable; in any case if speed is important, the compiler needs
to be involved.
(scm_sum): Adapt.
Diffstat (limited to 'libguile/integers.h')
-rw-r--r-- | libguile/integers.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libguile/integers.h b/libguile/integers.h index bd9f528b0..1dcd75112 100644 --- a/libguile/integers.h +++ b/libguile/integers.h @@ -166,6 +166,12 @@ SCM_INTERNAL int scm_is_integer_less_than_rz (double y, struct scm_bignum *x); SCM_INTERNAL int scm_is_integer_positive_z (struct scm_bignum *x); SCM_INTERNAL int scm_is_integer_negative_z (struct scm_bignum *x); +SCM_INTERNAL double scm_integer_to_double_z (struct scm_bignum *x); + +SCM_INTERNAL SCM scm_integer_add_ii (scm_t_inum x, scm_t_inum y); +SCM_INTERNAL SCM scm_integer_add_zi (struct scm_bignum *x, scm_t_inum y); +SCM_INTERNAL SCM scm_integer_add_zz (struct scm_bignum *x, struct scm_bignum *y); + #endif /* SCM_INTEGERS_H */ |