mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
(scm_to_short, scm_to_ushort): It's SHRT_MIN, etc, not SHORT_MIN.
(scm_to_size_t): Use SIZE_MAX instead of cooking our own. (scm_to_long_long, scm_to_ulong_long, scm_to_int8, scm_to_uint8, scm_to_int16, scm_to_uint16, scm_to_int32, scm_to_uint32, scm_to_int64, scm_to_uint64, scm_to_intmax, scm_to_uintmax, scm_from_long_long, scm_from_ulong_long, scm_from_int8, scm_from_uint8, scm_from_int16, scm_from_uint16, scm_from_int32, scm_from_uint32, scm_from_int64, scm_from_uint64, scm_from_intmax, scm_from_uintmax): New.
This commit is contained in:
parent
76bd98fa16
commit
22008a7804
1 changed files with 59 additions and 3 deletions
|
@ -367,9 +367,9 @@ SCM_API scm_t_uintmax scm_to_unsigned_integer (SCM val,
|
|||
#endif
|
||||
|
||||
#define scm_to_short(x) \
|
||||
((short)scm_to_signed_integer ((x), SHORT_MIN, SHORT_MAX))
|
||||
((short)scm_to_signed_integer ((x), SHRT_MIN, SHRT_MAX))
|
||||
#define scm_to_ushort(x) \
|
||||
((unsigned short)scm_to_unsigned_integer ((x), 0, SHORT_MAX))
|
||||
((unsigned short)scm_to_unsigned_integer ((x), 0, SHRT_MAX))
|
||||
|
||||
#define scm_to_int(x) \
|
||||
((int)scm_to_signed_integer ((x), INT_MIN, INT_MAX))
|
||||
|
@ -384,7 +384,41 @@ SCM_API scm_t_uintmax scm_to_unsigned_integer (SCM val,
|
|||
#define scm_to_ssize_t(x) \
|
||||
((ssize_t)scm_to_signed_integer ((x), -SSIZE_MAX-1, SSIZE_MAX))
|
||||
#define scm_to_size_t(x) \
|
||||
((unsigned long)scm_to_unsigned_integer ((x), 0, (~(size_t)0)))
|
||||
((unsigned long)scm_to_unsigned_integer ((x), 0, SIZE_MAX))
|
||||
|
||||
#if SCM_SIZEOF_LONG_LONG != 0
|
||||
#define scm_to_long_long(x) \
|
||||
((long long)scm_to_signed_integer ((x), SCM_I_LLONG_MIN, SCM_I_LLONG_MAX))
|
||||
#define scm_to_ulong_long(x) \
|
||||
((unsigned long long)scm_to_unsigned_integer ((x), 0, SCM_I_ULLONG_MAX))
|
||||
#endif
|
||||
|
||||
#define scm_to_int8(x) \
|
||||
((scm_t_int8)scm_to_signed_integer ((x), SCM_T_INT8_MIN, SCM_T_INT8_MAX))
|
||||
#define scm_to_uint8(x) \
|
||||
((scm_t_uint8)scm_to_unsigned_integer ((x), 0, SCM_T_UINT8_MAX))
|
||||
|
||||
#define scm_to_int16(x) \
|
||||
((scm_t_int16)scm_to_signed_integer ((x), SCM_T_INT16_MIN, SCM_T_INT16_MAX))
|
||||
#define scm_to_uint16(x) \
|
||||
((scm_t_uint16)scm_to_unsigned_integer ((x), 0, SCM_T_UINT16_MAX))
|
||||
|
||||
#define scm_to_int32(x) \
|
||||
((scm_t_int32)scm_to_signed_integer ((x), SCM_T_INT32_MIN, SCM_T_INT32_MAX))
|
||||
#define scm_to_uint32(x) \
|
||||
((scm_t_uint32)scm_to_unsigned_integer ((x), 0, SCM_T_UINT32_MAX))
|
||||
|
||||
#if SCM_HAVE_T_INT64
|
||||
#define scm_to_int64(x) \
|
||||
((scm_t_int64)scm_to_signed_integer ((x), SCM_T_INT64_MIN, SCM_T_INT64_MAX))
|
||||
#define scm_to_uint64(x) \
|
||||
((scm_t_uint64)scm_to_unsigned_integer ((x), 0, SCM_T_UINT64_MAX))
|
||||
#endif
|
||||
|
||||
#define scm_to_intmax(x) \
|
||||
((scm_t_intmax)scm_to_signed_integer ((x),SCM_T_INTMAX_MIN,SCM_T_INTMAX_MAX))
|
||||
#define scm_to_uintmax(x) \
|
||||
((scm_t_uintmax)scm_to_unsigned_integer ((x), 0, SCM_T_UINTMAX_MAX))
|
||||
|
||||
#define scm_from_schar(x) scm_from_signed_integer ((signed char)(x))
|
||||
#define scm_from_uchar(x) scm_from_unsigned_integer ((unsigned char)(x))
|
||||
|
@ -406,6 +440,28 @@ SCM_API scm_t_uintmax scm_to_unsigned_integer (SCM val,
|
|||
#define scm_from_ssize_t(x) scm_from_signed_integer ((ssize_t)(x))
|
||||
#define scm_from_size_t(x) scm_from_unsigned_integer ((size_t)(x))
|
||||
|
||||
#if SCM_SIZEOF_LONG_LONG != 0
|
||||
#define scm_from_long_long(x) scm_from_signed_integer ((long long)(x))
|
||||
#define scm_from_ulong_long(x) scm_from_unsigned_integer ((unsigned long long)(x))
|
||||
#endif
|
||||
|
||||
#define scm_from_int8(x) scm_from_signed_integer ((scm_t_int8)(x))
|
||||
#define scm_from_uint8(x) scm_from_unsigned_integer ((scm_t_uint8)(x))
|
||||
|
||||
#define scm_from_int16(x) scm_from_signed_integer ((scm_t_int16)(x))
|
||||
#define scm_from_uint16(x) scm_from_unsigned_integer ((scm_t_uint16)(x))
|
||||
|
||||
#define scm_from_int32(x) scm_from_signed_integer ((scm_t_int32)(x))
|
||||
#define scm_from_uint32(x) scm_from_unsigned_integer ((scm_t_uint32)(x))
|
||||
|
||||
#if SCM_HAVE_T_INT64
|
||||
#define scm_from_int64(x) scm_from_signed_integer ((scm_t_int64)(x))
|
||||
#define scm_from_uint64(x) scm_from_unsigned_integer ((scm_t_uint64)(x))
|
||||
#endif
|
||||
|
||||
#define scm_from_intmax(x) scm_from_signed_integer ((scm_t_intmax)(x))
|
||||
#define scm_from_uintmax(x) scm_from_unsigned_integer ((scm_t_uintmax)(x))
|
||||
|
||||
SCM_API int scm_is_real (SCM val);
|
||||
SCM_API double scm_to_double (SCM val);
|
||||
SCM_API SCM scm_from_double (double val);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue