1
Fork 0
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:
Michael Gran 2009-08-20 21:33:49 -07:00
parent 68a30f5730
commit 43d5626ce7

View file

@ -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