summaryrefslogtreecommitdiff
path: root/libguile/numbers.h
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2011-02-10 19:04:05 -0500
committerAndy Wingo <wingo@pobox.com>2011-02-14 20:32:54 +0100
commit5093e51839bb1246e96547a25ae41b4c4d92e1f7 (patch)
tree38d82e0d07bba8279184f5e48f842f659a9ddba5 /libguile/numbers.h
parentf135fc3eda9a34f9540486da433867b2698fa58c (diff)
downloadguile-5093e51839bb1246e96547a25ae41b4c4d92e1f7.tar.gz
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.
Diffstat (limited to 'libguile/numbers.h')
-rw-r--r--libguile/numbers.h4
1 files changed, 1 insertions, 3 deletions
diff --git a/libguile/numbers.h b/libguile/numbers.h
index bc2d4f243..ab96981c6 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))