Unbox literals at expansion time.
This commit is contained in:
parent
bdf84f371d
commit
1105e70b30
|
@ -256,6 +256,31 @@
|
|||
#:with (bindings ...) #'())
|
||||
|
||||
;; else, do the unboxing here
|
||||
|
||||
;; we can unbox literals right away
|
||||
(pattern (quote n)
|
||||
#:when (let ((x (syntax->datum #'n)))
|
||||
(and (number? x)
|
||||
(not (eq? (imag-part x) 0))))
|
||||
#:with real-binding (unboxed-gensym)
|
||||
#:with imag-binding (unboxed-gensym)
|
||||
#:with (bindings ...)
|
||||
(let ((n (syntax->datum #'n)))
|
||||
#`(((real-binding) #,(datum->syntax
|
||||
#'here
|
||||
(exact->inexact (real-part n))))
|
||||
((imag-binding) #,(datum->syntax
|
||||
#'here
|
||||
(exact->inexact (imag-part n)))))))
|
||||
(pattern (quote n)
|
||||
#:when (real? (syntax->datum #'n))
|
||||
#:with real-binding (unboxed-gensym)
|
||||
#:with imag-binding #f
|
||||
#:with (bindings ...)
|
||||
#`(((real-binding) #,(datum->syntax
|
||||
#'here
|
||||
(exact->inexact (syntax->datum #'n))))))
|
||||
|
||||
(pattern e:expr
|
||||
#:when (isoftype? #'e -InexactComplex)
|
||||
#:with e* (unboxed-gensym)
|
||||
|
|
Loading…
Reference in New Issue
Block a user