mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-16 08:40:19 +02:00
* read.c (scm_lreadr): When reading a hash token, check for a
user-defined hash procedure first, so that overriding the builtin hash characters is possible (this was needed for implementing SRFI-4's read synax `f32(...)'). * num2integral.i.c: Use scm_t_signed_bits instead of scm_t_bits, because the latter is unsigned now and breaks comparisons like (n < (scm_t_signed_bits)MIN_VALUE).
This commit is contained in:
parent
dbfadc8588
commit
b858464a0a
3 changed files with 59 additions and 27 deletions
|
@ -6,22 +6,22 @@ NUM2INTEGRAL (SCM num, unsigned long int pos, const char *s_caller)
|
|||
if (SCM_INUMP (num))
|
||||
{ /* immediate */
|
||||
|
||||
scm_t_bits n = SCM_INUM (num);
|
||||
scm_t_signed_bits n = SCM_INUM (num);
|
||||
|
||||
#ifdef UNSIGNED
|
||||
if (n < 0)
|
||||
scm_out_of_range (s_caller, num);
|
||||
#endif
|
||||
|
||||
if (sizeof (ITYPE) >= sizeof (scm_t_bits))
|
||||
if (sizeof (ITYPE) >= sizeof (scm_t_signed_bits))
|
||||
/* can't fit anything too big for this type in an inum
|
||||
anyway */
|
||||
return (ITYPE) n;
|
||||
else
|
||||
{ /* an inum can be out of range, so check */
|
||||
if (n > (scm_t_bits)MAX_VALUE
|
||||
if (n > (scm_t_signed_bits)MAX_VALUE
|
||||
#ifndef UNSIGNED
|
||||
|| n < (scm_t_bits)MIN_VALUE
|
||||
|| n < (scm_t_signed_bits)MIN_VALUE
|
||||
#endif
|
||||
)
|
||||
scm_out_of_range (s_caller, num);
|
||||
|
@ -84,7 +84,7 @@ NUM2INTEGRAL (SCM num, unsigned long int pos, const char *s_caller)
|
|||
SCM
|
||||
INTEGRAL2NUM (ITYPE n)
|
||||
{
|
||||
if (sizeof (ITYPE) < sizeof (scm_t_bits)
|
||||
if (sizeof (ITYPE) < sizeof (scm_t_signed_bits)
|
||||
||
|
||||
#ifndef UNSIGNED
|
||||
SCM_FIXABLE (n)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue