[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Add `fixnum?' VM primitive
From: |
Ludovic Courtès |
Subject: |
Re: [PATCH] Add `fixnum?' VM primitive |
Date: |
Thu, 24 Mar 2011 23:01:21 +0100 |
User-agent: |
Gnus/5.110013 (No Gnus v0.13) Emacs/23.3 (gnu/linux) |
Hi!
Andreas Rottmann <address@hidden> writes:
> +SCM_DEFINE (scm_fixnum_p, "fixnum?", 1, 0, 0,
> + (SCM x),
> + "Return @code{#t} if @var{x} is a fixnum, @code{#f} otherwise.")
> +#define FUNC_NAME s_scm_fixnum_p
> +{
> + return scm_from_bool (SCM_I_INUMP (x));
> +}
> +#undef FUNC_NAME
For 2.0 I think you could go with this wonderful hack:
(define (fixnum? x)
(not (= 0 (logand 2 (object-address x)))))
(An inlinable variant thereof, as done in srfi-9.scm.)
For ‘master’ your patch looks good to me modulo a few details. Why did
you need to renumber VM opcodes? Also, I’d prefer not to have ‘fixnum?’
in the default name space because:
1. In Guile parlance, it’d rather be ‘immediate-number?’ (info
"(guile) Immediate objects").
2. I think this fixnum thing is a breach in the numerical tower.
Thanks,
Ludo’.
- fixnum? VM primitive, increasing fixnum operation speed, Andreas Rottmann, 2011/03/22
- [PATCH] Add `fixnum?' VM primitive, Andreas Rottmann, 2011/03/22
- Re: [PATCH] Add `fixnum?' VM primitive,
Ludovic Courtès <=
- Re: [PATCH] Add `fixnum?' VM primitive, Andreas Rottmann, 2011/03/24
- Re: [PATCH] Add `fixnum?' VM primitive, Ludovic Courtès, 2011/03/25
- Re: [PATCH] Add `fixnum?' VM primitive, Andreas Rottmann, 2011/03/25
- Re: [PATCH] Add `fixnum?' VM primitive, Ludovic Courtès, 2011/03/25
- Re: [PATCH] Add `fixnum?' VM primitive, Andy Wingo, 2011/03/29
- Re: [PATCH] Add `fixnum?' VM primitive, Ken Raeburn, 2011/03/28
- Re: [PATCH] Add `fixnum?' VM primitive, Andy Wingo, 2011/03/29
- Re: [PATCH] Add `fixnum?' VM primitive, Andy Wingo, 2011/03/29
- Re: [PATCH] Add `fixnum?' VM primitive, Andy Wingo, 2011/03/29