(declare (extended-bindings) (not constant-fold) (not safe))

(define a 0)
(define b 536870911)
(define c -536870912)
(define d 1)
(define e -1)
(define f 357913941)

(define (test-neg x)
  (println (##fxwraparithmetic-shift x -1))
  (println (##fxwraparithmetic-shift x -2))
  (println (##fxwraparithmetic-shift x -10))
  (println (##fxwraparithmetic-shift x -20))
  (println (##fxwraparithmetic-shift x -29)))

(define (test-pos x)
  (println (##fxwraparithmetic-shift x 0))
  (println (##fxwraparithmetic-shift x 1))
  (println (##fxwraparithmetic-shift x 2))
  (println (##fxwraparithmetic-shift x 10))
  (println (##fxwraparithmetic-shift x 20))
  (println (##fxwraparithmetic-shift x 29)))

(test-pos a)
(test-neg a)
(test-neg b)
(test-neg c)
(test-pos d)
(test-neg d)
(test-pos e)
(test-neg e)

(println (##fxwraparithmetic-shift f -2))
(println (##fxwraparithmetic-shift f -1))
(println (##fxwraparithmetic-shift f 0))
(println (##fxwraparithmetic-shift f 1))
(println (##fxwraparithmetic-shift f 2))
