From 261b557202542dce281ef09ee939b70eeadaee11 Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Thu, 10 Feb 2011 19:04:05 -0500 Subject: [PATCH 8/9] 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. --- libguile/numbers.h | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/libguile/numbers.h b/libguile/numbers.h index bc2d4f2..ab96981 100644 --- a/libguile/numbers.h +++ b/libguile/numbers.h @@ -138,9 +138,7 @@ typedef scm_t_int32 scm_t_wchar; #define SCM_NUMBERP(x) (SCM_I_INUMP(x) || SCM_NUMP(x)) #define SCM_NUMP(x) (!SCM_IMP(x) \ - && (((0xfcff & 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 */ + && ((0x00ff & SCM_CELL_TYPE (x)) == scm_tc7_number)) #define SCM_FRACTIONP(x) (!SCM_IMP (x) && SCM_TYP16 (x) == scm_tc16_fraction) #define SCM_FRACTION_NUMERATOR(x) (SCM_CELL_OBJECT_1 (x)) -- 1.7.1