diff options
author | Michael Gran <spk121@yahoo.com> | 2009-08-20 21:33:49 -0700 |
---|---|---|
committer | Michael Gran <spk121@yahoo.com> | 2009-08-20 21:40:03 -0700 |
commit | 43d5626ce7b51c6f9c06b3a5fe513003778402c8 (patch) | |
tree | ca52acb6a8b01e529fed922a54109a3aa61375da /libguile | |
parent | 68a30f5730e73b9792565c3c99b5724752472a85 (diff) | |
download | guile-43d5626ce7b51c6f9c06b3a5fe513003778402c8.tar.gz |
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
Diffstat (limited to 'libguile')
-rw-r--r-- | libguile/conv-uinteger.i.c | 25 |
1 files 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 |