From 4e3f1c1e4b828efb53b05b27a301db38258fa20b Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Tue, 13 Jul 2010 11:31:02 -0400 Subject: [PATCH] Added unboxed complex conjugate. original commit: 063211d92263267b8e6b2703af70d9a46e7186bf --- collects/typed-scheme/optimizer/inexact-complex.rkt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/collects/typed-scheme/optimizer/inexact-complex.rkt b/collects/typed-scheme/optimizer/inexact-complex.rkt index bdaaadc3..a3865450 100644 --- a/collects/typed-scheme/optimizer/inexact-complex.rkt +++ b/collects/typed-scheme/optimizer/inexact-complex.rkt @@ -2,7 +2,7 @@ (require syntax/parse "../utils/utils.rkt" - (for-template scheme/base scheme/flonum scheme/unsafe/ops) + (for-template scheme/base scheme/math scheme/flonum scheme/unsafe/ops) (types abbrev type-table utils subtype) (optimizer utils float)) @@ -104,6 +104,13 @@ (unsafe-fl* #,o2 #,(car e2))) #,(car d))) res))))))) + (pattern (#%plain-app (~and op (~literal conjugate)) c:unboxed-inexact-complex-opt-expr) + #:with real-part #'c.real-part + #:with imag-part (unboxed-gensym) + #:with (bindings ...) + (begin (log-optimization "unboxed unary inexact complex" #'op) + #`(#,@(append (syntax->list #'(c.bindings ...)) + (list #'(imag-part (unsafe-fl- 0.0 c.imag-part))))))) (pattern e:expr ;; can't work on inexact reals, which are a subtype of inexact ;; complexes, so this has to be equality