mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-29 22:40:34 +02:00
Make SCM_NUMP and SCM_NUMBERP more extensible
* libguile/numbers.h (SCM_NUMP, SCM_NUMBERP): Mask out more bits in the cell type field when doing the comparison, in order to accept future numeric types that have not yet been implemented. This should allow us to add more core numeric types without breaking ABI compatibility. As a bonus, these macros are now more efficient.
This commit is contained in:
parent
f135fc3eda
commit
5093e51839
1 changed files with 1 additions and 3 deletions
|
@ -138,9 +138,7 @@ typedef scm_t_int32 scm_t_wchar;
|
||||||
|
|
||||||
#define SCM_NUMBERP(x) (SCM_I_INUMP(x) || SCM_NUMP(x))
|
#define SCM_NUMBERP(x) (SCM_I_INUMP(x) || SCM_NUMP(x))
|
||||||
#define SCM_NUMP(x) (!SCM_IMP(x) \
|
#define SCM_NUMP(x) (!SCM_IMP(x) \
|
||||||
&& (((0xfcff & SCM_CELL_TYPE (x)) == scm_tc7_number) \
|
&& ((0x00ff & SCM_CELL_TYPE (x)) == scm_tc7_number))
|
||||||
|| ((0xfbff & SCM_CELL_TYPE (x)) == scm_tc7_number)))
|
|
||||||
/* 0xfcff (#b1100) for 0 free, 1 big, 2 real, 3 complex, then 0xfbff (#b1011) for 4 fraction */
|
|
||||||
|
|
||||||
#define SCM_FRACTIONP(x) (!SCM_IMP (x) && SCM_TYP16 (x) == scm_tc16_fraction)
|
#define SCM_FRACTIONP(x) (!SCM_IMP (x) && SCM_TYP16 (x) == scm_tc16_fraction)
|
||||||
#define SCM_FRACTION_NUMERATOR(x) (SCM_CELL_OBJECT_1 (x))
|
#define SCM_FRACTION_NUMERATOR(x) (SCM_CELL_OBJECT_1 (x))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue