tweak case
fixnum-only dispatch
Use `fixnum?` instead of `fixnum-for-any-platform?` when only fixnums-on-any-platform are relevant.
This commit is contained in:
parent
8751e5b75f
commit
3b1f457375
|
@ -572,6 +572,33 @@
|
|||
(test 1 f #s(o n e))
|
||||
(test (void) f #f))
|
||||
|
||||
;; Make sure a mixture of fixnums and non-fixnums works:
|
||||
(let ()
|
||||
(define (f x)
|
||||
(case x
|
||||
[(1) 'one]
|
||||
[(1000) 'onek]
|
||||
[(1001) 'onek+]
|
||||
[(1002) 'onek+]
|
||||
[(1003) 'onek+]
|
||||
[(1000000) 'onem]
|
||||
[(1000000000) 'onet]
|
||||
[(1000000000000) 'oneqd]
|
||||
[(1000000000001) 'oneqd+]
|
||||
[(1000000000002) 'oneqd+]
|
||||
[(1000000000003) 'oneqd+]
|
||||
[(1000000000000000) 'oneqt]
|
||||
[(1000000000000000000) 'ones]
|
||||
[(1000000000000000001) 'ones+]
|
||||
[(1000000000000000002) 'ones+]))
|
||||
(test 'one f 1)
|
||||
(test 'onek f 1000)
|
||||
(test 'onem f 1000000)
|
||||
(test 'onet f 1000000000)
|
||||
(test 'oneqd f 1000000000000)
|
||||
(test 'oneqt f 1000000000000000)
|
||||
(test 'ones f 1000000000000000000))
|
||||
|
||||
(test #t 'and (and (= 2 2) (> 2 1)))
|
||||
(test #f 'and (and (= 2 2) (< 2 1)))
|
||||
(test '(f g) 'and (and 1 2 'c '(f g)))
|
||||
|
|
|
@ -167,7 +167,11 @@
|
|||
#,exp))]
|
||||
[exp (if (null? (consts-fixnum ks))
|
||||
exp
|
||||
#`(if (fixnum-for-every-system? v)
|
||||
#`(if #,(if (null? (consts-other ks))
|
||||
;; can check for fixnum
|
||||
#'(fixnum? v)
|
||||
;; maybe could-be-fixnum numbers are in `others`
|
||||
#'(fixnum-for-every-system? v))
|
||||
#,(dispatch-fixnum #'v (consts-fixnum ks))
|
||||
#,exp))])
|
||||
exp)])
|
||||
|
|
|
@ -465,9 +465,6 @@
|
|||
(if (list? a_0)
|
||||
(append a_0 b_0)
|
||||
(raise-argument-error 'unquote-splicing "list?" a_0))))
|
||||
(define fixnum-for-every-system?
|
||||
(lambda (v_0)
|
||||
(if (fixnum? v_0) (if (fx>= v_0 -536870912) (fx<= v_0 536870911) #f) #f)))
|
||||
(define bad-list$1
|
||||
(|#%name|
|
||||
bad-list
|
||||
|
@ -24569,7 +24566,7 @@
|
|||
(begin
|
||||
(let ((type_0 (read-byte/no-eof i_0)))
|
||||
(let ((index_0
|
||||
(if (fixnum-for-every-system? type_0)
|
||||
(if (fixnum? type_0)
|
||||
(if (if (unsafe-fx>= type_0 1)
|
||||
(unsafe-fx< type_0 42)
|
||||
#f)
|
||||
|
|
|
@ -47963,7 +47963,7 @@
|
|||
(begin
|
||||
(let ((type_0 (read-byte/no-eof i_0)))
|
||||
(let ((index_0
|
||||
(if (fixnum-for-every-system? type_0)
|
||||
(if (fixnum? type_0)
|
||||
(if (if (unsafe-fx>= type_0 1)
|
||||
(unsafe-fx< type_0 42)
|
||||
#f)
|
||||
|
|
Loading…
Reference in New Issue
Block a user