[racket] Bug in bitwise-bit-field

From: Richard Cleis (rcleis at me.com)
Date: Tue Jun 17 01:14:43 EDT 2014

What do you get when you evaluate #b11111111111111111111111111100010 ?

rac

On Jun 16, 2014, at 9:32 PM, Roman Klochkov wrote:

> ;; from Racket reference 4.2.2.6
> (define (bitwise-bit-field* n start end)
>    (bitwise-and (sub1 (arithmetic-shift 1 (- end start)))
>                            (arithmetic-shift n (- start))))
> 
> > (bitwise-bit-field #b11111111111111111111111111100010 0 31)
> -30
> > (bitwise-bit-field* #b11111111111111111111111111100010 0 31)
> 2147483618
> 
> Racket 6.0.1, Windows XP x86
> 
> -- 
> Roman Klochkov
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140616/77254842/attachment.html>

Posted on the users mailing list.