[racket-dev] [plt] Push #23009: master branch updated

From: Vincent St-Amour (stamourv at ccs.neu.edu)
Date: Wed Jul 13 12:50:55 EDT 2011

At Wed, 13 Jul 2011 12:25:42 -0400,
Sam Tobin-Hochstadt wrote:
> 
> On Wed, Jul 13, 2011 at 12:08 PM,  <stamourv at racket-lang.org> wrote:
> >
> >  ;; we assume indexes are 2 bits shorter than fixnums
> >  ;; We're generating a reference to fixnum? rather than calling it, so
> >  ;; we're safe from fixnum size issues on different platforms.
> > -(define (index? x) (and (fixnum? x) (>= x 0) (fixnum? (* x 4))))
> > +(define (index? x)
> > +  (and (fixnum? x) (unsafe-fx>= x 0) (fixnum? (unsafe-fx* x 4))))
> 
> How is this possibly ok?  If `x' is (/ MAX_FIXNUM 2), then this code
> has no semantics.

Good point, the multiplication is unsafe.

I'll fix that.

Vincent



Posted on the dev mailing list.