diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2012-03-20 12:11:38 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2012-03-20 12:11:38 -0700 |
commit | 270dcc27814f4bd80f625b85e9ff91e7c5a8e8a8 (patch) | |
tree | af016173b3eb8785928466032f97f772c5f0dc04 /lib.c | |
parent | 49b84f76e1036ebeb75b4348d1d0cf7fdf233939 (diff) | |
download | txr-270dcc27814f4bd80f625b85e9ff91e7c5a8e8a8.tar.gz txr-270dcc27814f4bd80f625b85e9ff91e7c5a8e8a8.tar.bz2 txr-270dcc27814f4bd80f625b85e9ff91e7c5a8e8a8.zip |
* arith.c (plus): Optimization: use num_fast when
result is in the fixnum range.
Implemented FLNUM cases, except for adding a FLNUM
to BGNUM.
(minus, mul): Use num_fast when the cnum value is in the fixnum range.
(int_flo): New function.
* eval.c (eval_init): Register int-flo intrinsic.
* lib.c (c_flo): New function.
* lib.h (TYPE_SHIFT, TYPE_PAIR): New macros, carried over
from the lazy strings branch.
(c_flo, int_flo): Declared.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -1135,6 +1135,12 @@ val flo(double n) return obj; } +double c_flo(val num) +{ + type_check(num, FLNUM); + return num->fl.n; +} + val fixnump(val num) { return (is_num(num)) ? t : nil; |