From 43d5626ce7b51c6f9c06b3a5fe513003778402c8 Mon Sep 17 00:00:00 2001 From: Michael Gran Date: Thu, 20 Aug 2009 21:33:49 -0700 Subject: [PATCH] Avoid type-limits warning in SCM_TO_TYPE_PROTO * libguile/conv-uinteger.i.c (SCM_TO_TYPE_PROTO): avoid a comparison that is always true due to the limited range of the data type --- libguile/conv-uinteger.i.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/libguile/conv-uinteger.i.c b/libguile/conv-uinteger.i.c index ff0d28012..52f49f772 100644 --- a/libguile/conv-uinteger.i.c +++ b/libguile/conv-uinteger.i.c @@ -53,10 +53,17 @@ SCM_TO_TYPE_PROTO (SCM 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; + +#if TYPE_MIN == 0 + if (n <= TYPE_MAX) + return n; +#else /* TYPE_MIN != 0 */ + if (n >= TYPE_MIN && n <= TYPE_MAX) + return n; +#endif /* TYPE_MIN != 0 */ + else + goto out_of_range; + #endif } else @@ -76,10 +83,16 @@ SCM_TO_TYPE_PROTO (SCM val) mpz_export (&n, &count, 1, sizeof (TYPE), 0, 0, SCM_I_BIG_MPZ (val)); +#if TYPE_MIN == 0 + if (n <= TYPE_MAX) + return n; +#else /* TYPE_MIN != 0 */ if (n >= TYPE_MIN && n <= TYPE_MAX) return n; - else - goto out_of_range; +#endif /* TYPE_MIN != 0 */ + else + goto out_of_range; + } } else