mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 20:00:19 +02:00
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
This commit is contained in:
parent
68a30f5730
commit
43d5626ce7
1 changed files with 19 additions and 6 deletions
|
@ -53,10 +53,17 @@ SCM_TO_TYPE_PROTO (SCM val)
|
|||
#if SIZEOF_TYPE != 0 && SIZEOF_TYPE > SCM_SIZEOF_LONG
|
||||
return n;
|
||||
#else
|
||||
|
||||
#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;
|
||||
#endif /* TYPE_MIN != 0 */
|
||||
else
|
||||
goto out_of_range;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue