[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 54/69: Remove unused conv-{u,}integer.i.c
From: |
Andy Wingo |
Subject: |
[Guile-commits] 54/69: Remove unused conv-{u,}integer.i.c |
Date: |
Fri, 7 Jan 2022 08:27:18 -0500 (EST) |
wingo pushed a commit to branch wip-inline-digits
in repository guile.
commit 4eed7587a8a6ffe9a26275cd62f5a8ea8773a76f
Author: Andy Wingo <wingo@pobox.com>
AuthorDate: Thu Jan 6 21:30:17 2022 +0100
Remove unused conv-{u,}integer.i.c
* libguile/Makefile.am (noinst_HEADERS):
* libguile/conv-integer.i.c:
* libguile/conv-uinteger.i.c: Remove.
---
libguile/Makefile.am | 5 +-
libguile/conv-integer.i.c | 148 ---------------------------------------------
libguile/conv-uinteger.i.c | 121 ------------------------------------
3 files changed, 2 insertions(+), 272 deletions(-)
diff --git a/libguile/Makefile.am b/libguile/Makefile.am
index a06f950de..40619d379 100644
--- a/libguile/Makefile.am
+++ b/libguile/Makefile.am
@@ -1,6 +1,6 @@
## Process this file with Automake to create Makefile.in
##
-## Copyright (C) 1998-2004, 2006-2014, 2016-2021
+## Copyright (C) 1998-2004, 2006-2014, 2016-2022
## Free Software Foundation, Inc.
##
## This file is part of GUILE.
@@ -527,8 +527,7 @@ uninstall-hook:
## compile, since they are #included. So instead we list them here.
## Perhaps we can deal with them normally once the merge seems to be
## working.
-noinst_HEADERS = conv-integer.i.c conv-uinteger.i.c \
- elf.h \
+noinst_HEADERS = elf.h \
integers.h \
intrinsics.h \
srfi-14.i.c \
diff --git a/libguile/conv-integer.i.c b/libguile/conv-integer.i.c
deleted file mode 100644
index 7d6bd347e..000000000
--- a/libguile/conv-integer.i.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/* This code in included by numbers.c to generate integer conversion
- functions like scm_to_int and scm_from_int. It is only for signed
- types, see conv-uinteger.i.c for the unsigned variant.
-*/
-
-/* You need to define the following macros before including this
- template. They are undefined at the end of this file to give a
- clean slate for the next inclusion.
-
- TYPE - the integral type to be converted
- TYPE_MIN - the smallest representable number of TYPE
- TYPE_MAX - the largest representable number of TYPE
- SIZEOF_TYPE - the size of TYPE, equal to "sizeof (TYPE)" but
- in a form that can be computed by the preprocessor.
- When this number is 0, the preprocessor is not used
- to select which code to compile; the most general
- code is always used.
-
- SCM_TO_TYPE_PROTO(arg), SCM_FROM_TYPE_PROTO(arg)
- - These two macros should expand into the prototype
- for the two defined functions, without the return
- type.
-
-*/
-
-TYPE
-SCM_TO_TYPE_PROTO (SCM val)
-{
- if (SCM_I_INUMP (val))
- {
- scm_t_signed_bits n = SCM_I_INUM (val);
-#if SIZEOF_TYPE != 0 && SIZEOF_TYPE > SIZEOF_UINTPTR_T
- return n;
-#else
- if (n >= TYPE_MIN && n <= TYPE_MAX)
- return n;
- else
- {
- goto out_of_range;
- }
-#endif
- }
- else if (SCM_BIGP (val))
- {
- if (TYPE_MIN >= SCM_MOST_NEGATIVE_FIXNUM
- && TYPE_MAX <= SCM_MOST_POSITIVE_FIXNUM)
- goto out_of_range;
- else if (TYPE_MIN >= LONG_MIN && TYPE_MAX <= LONG_MAX)
- {
- if (mpz_fits_slong_p (SCM_I_BIG_MPZ (val)))
- {
- long n = mpz_get_si (SCM_I_BIG_MPZ (val));
-#if SIZEOF_TYPE != 0 && SIZEOF_TYPE > SCM_SIZEOF_LONG
- return n;
-#else
- if (n >= TYPE_MIN && n <= TYPE_MAX)
- return n;
- else
- goto out_of_range;
-#endif
- }
- else
- goto out_of_range;
- }
- else
- {
- uintmax_t abs_n;
- TYPE n;
- size_t count;
-
- if (mpz_sizeinbase (SCM_I_BIG_MPZ (val), 2)
- > CHAR_BIT*sizeof (uintmax_t))
- goto out_of_range;
-
- mpz_export (&abs_n, &count, 1, sizeof (uintmax_t), 0, 0,
- SCM_I_BIG_MPZ (val));
-
- if (mpz_sgn (SCM_I_BIG_MPZ (val)) >= 0)
- {
- if (abs_n <= TYPE_MAX)
- n = abs_n;
- else
- goto out_of_range;
- }
- else
- {
- /* Carefully avoid signed integer overflow. */
- if (TYPE_MIN < 0 && abs_n - 1 <= -(TYPE_MIN + 1))
- n = -1 - (TYPE)(abs_n - 1);
- else
- goto out_of_range;
- }
-
- if (n >= TYPE_MIN && n <= TYPE_MAX)
- return n;
- else
- {
- out_of_range:
- scm_i_range_error (val,
- scm_from_signed_integer (TYPE_MIN),
- scm_from_signed_integer (TYPE_MAX));
- return 0;
- }
- }
- }
- else
- {
- scm_wrong_type_arg_msg (NULL, 0, val, "exact integer");
- return 0;
- }
-}
-
-SCM
-SCM_FROM_TYPE_PROTO (TYPE val)
-{
-#if SIZEOF_TYPE != 0 && SIZEOF_TYPE < SIZEOF_UINTPTR_T
- return SCM_I_MAKINUM (val);
-#else
- if (SCM_FIXABLE (val))
- return SCM_I_MAKINUM (val);
- else if (val >= LONG_MIN && val <= LONG_MAX)
- return scm_i_long2big (val);
- else
- {
- SCM z = make_bignum ();
- mpz_init (SCM_I_BIG_MPZ (z));
- if (val < 0)
- {
- val = -val;
- mpz_import (SCM_I_BIG_MPZ (z), 1, 1, sizeof (TYPE), 0, 0,
- &val);
- mpz_neg (SCM_I_BIG_MPZ (z), SCM_I_BIG_MPZ (z));
- }
- else
- mpz_import (SCM_I_BIG_MPZ (z), 1, 1, sizeof (TYPE), 0, 0,
- &val);
- return z;
- }
-#endif
-}
-
-/* clean up */
-#undef TYPE
-#undef TYPE_MIN
-#undef TYPE_MAX
-#undef SIZEOF_TYPE
-#undef SCM_TO_TYPE_PROTO
-#undef SCM_FROM_TYPE_PROTO
diff --git a/libguile/conv-uinteger.i.c b/libguile/conv-uinteger.i.c
deleted file mode 100644
index f9203771a..000000000
--- a/libguile/conv-uinteger.i.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/* This code in included by number.s.c to generate integer conversion
- functions like scm_to_int and scm_from_int. It is only for
- unsigned types, see conv-integer.i.c for the signed variant.
-*/
-
-/* You need to define the following macros before including this
- template. They are undefined at the end of this file to giove a
- clean slate for the next inclusion.
-
- TYPE - the integral type to be converted
- TYPE_MIN - the smallest representable number of TYPE, typically 0.
- TYPE_MAX - the largest representable number of TYPE
- SIZEOF_TYPE - the size of TYPE, equal to "sizeof (TYPE)" but
- in a form that can be computed by the preprocessor.
- When this number is 0, the preprocessor is not used
- to select which code to compile; the most general
- code is always used.
-
- SCM_TO_TYPE_PROTO(arg), SCM_FROM_TYPE_PROTO(arg)
- - These two macros should expand into the prototype
- for the two defined functions, without the return
- type.
-
-*/
-
-TYPE
-SCM_TO_TYPE_PROTO (SCM val)
-{
- if (SCM_I_INUMP (val))
- {
- scm_t_signed_bits n = SCM_I_INUM (val);
- if (n >= 0
- && ((uintmax_t)n) >= TYPE_MIN && ((uintmax_t)n) <= TYPE_MAX)
- return n;
- else
- {
- out_of_range:
- scm_i_range_error (val,
- scm_from_unsigned_integer (TYPE_MIN),
- scm_from_unsigned_integer (TYPE_MAX));
- return 0;
- }
- }
- else if (SCM_BIGP (val))
- {
- if (TYPE_MAX <= SCM_MOST_POSITIVE_FIXNUM)
- goto out_of_range;
- else if (TYPE_MAX <= ULONG_MAX)
- {
- if (mpz_fits_ulong_p (SCM_I_BIG_MPZ (val)))
- {
- unsigned long n = mpz_get_ui (SCM_I_BIG_MPZ (val));
-#if SIZEOF_TYPE != 0 && SIZEOF_TYPE > SCM_SIZEOF_LONG
- return n;
-#else
-
- if (n >= TYPE_MIN && n <= TYPE_MAX)
- return n;
- else
- goto out_of_range;
-
-#endif
- }
- else
- goto out_of_range;
- }
- else
- {
- uintmax_t n;
- size_t count;
-
- if (mpz_sgn (SCM_I_BIG_MPZ (val)) < 0)
- goto out_of_range;
-
- if (mpz_sizeinbase (SCM_I_BIG_MPZ (val), 2)
- > CHAR_BIT*sizeof (TYPE))
- goto out_of_range;
-
- mpz_export (&n, &count, 1, sizeof (TYPE), 0, 0, SCM_I_BIG_MPZ (val));
-
- if (n >= TYPE_MIN && n <= TYPE_MAX)
- return n;
- else
- goto out_of_range;
-
- }
- }
- else
- {
- scm_wrong_type_arg_msg (NULL, 0, val, "exact integer");
- return 0;
- }
-}
-
-SCM
-SCM_FROM_TYPE_PROTO (TYPE val)
-{
-#if SIZEOF_TYPE != 0 && SIZEOF_TYPE < SIZEOF_UINTPTR_T
- return SCM_I_MAKINUM (val);
-#else
- if (SCM_POSFIXABLE (val))
- return SCM_I_MAKINUM (val);
- else if (val <= ULONG_MAX)
- return scm_i_ulong2big (val);
- else
- {
- SCM z = make_bignum ();
- mpz_init (SCM_I_BIG_MPZ (z));
- mpz_import (SCM_I_BIG_MPZ (z), 1, 1, sizeof (TYPE), 0, 0, &val);
- return z;
- }
-#endif
-}
-
-#undef TYPE
-#undef TYPE_MIN
-#undef TYPE_MAX
-#undef SIZEOF_TYPE
-#undef SCM_TO_TYPE_PROTO
-#undef SCM_FROM_TYPE_PROTO
-
- [Guile-commits] 27/69: Implement scm_lognot with new integer library, (continued)
- [Guile-commits] 27/69: Implement scm_lognot with new integer library, Andy Wingo, 2022/01/07
- [Guile-commits] 26/69: Implement scm_logbit_p with new integer library, Andy Wingo, 2022/01/07
- [Guile-commits] 25/69: Implement scm_logtest with new integer library, Andy Wingo, 2022/01/07
- [Guile-commits] 33/69: Integer library takes bignums via opaque struct pointer, Andy Wingo, 2022/01/07
- [Guile-commits] 37/69: Build scm_integer_p on scm_is_integer, not vice versa, Andy Wingo, 2022/01/07
- [Guile-commits] 36/69: Simplify scm_bigprint, Andy Wingo, 2022/01/07
- [Guile-commits] 38/69: Reimplement = on integer lib, clean up scm_num_eq_p, Andy Wingo, 2022/01/07
- [Guile-commits] 41/69: Simplify implementation of min, max, Andy Wingo, 2022/01/07
- [Guile-commits] 46/69: Clean up scm_divide, Andy Wingo, 2022/01/07
- [Guile-commits] 48/69: Fix scm_integer_to_double_z to always round; clean ups, Andy Wingo, 2022/01/07
- [Guile-commits] 54/69: Remove unused conv-{u,}integer.i.c,
Andy Wingo <=
- [Guile-commits] 58/69: Expose frexp from integers lib, Andy Wingo, 2022/01/07
- [Guile-commits] 18/69: Implement round-remainder with new integer lib, Andy Wingo, 2022/01/07
- [Guile-commits] 28/69: Implement scm_modulo_expt with new integer library, Andy Wingo, 2022/01/07
- [Guile-commits] 21/69: Implement lcm with new integer lib, Andy Wingo, 2022/01/07
- [Guile-commits] 30/69: Implement scm_ash with new integer library, Andy Wingo, 2022/01/07
- [Guile-commits] 32/69: Implement scm_logcount with new integer library, Andy Wingo, 2022/01/07
- [Guile-commits] 35/69: Implement integer-to-string with new integer library, Andy Wingo, 2022/01/07
- [Guile-commits] 05/69: Implement floor-quotient with new integer lib, Andy Wingo, 2022/01/07
- [Guile-commits] 06/69: Implement floor-remainder with new integer lib, Andy Wingo, 2022/01/07
- [Guile-commits] 14/69: Implement centered-quotient with new integer lib, Andy Wingo, 2022/01/07