diff gen/complex.cpp @ 164:a64becf2a702 trunk

[svn r180] Fixed complex negation, and tango.math.Math now compiles.
author lindquist
date Mon, 05 May 2008 20:28:59 +0200
parents 44a95ac7368a
children 9d44ec83acd1
line wrap: on
line diff
--- a/gen/complex.cpp	Mon May 05 07:36:29 2008 +0200
+++ b/gen/complex.cpp	Mon May 05 20:28:59 2008 +0200
@@ -282,6 +282,24 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
+DValue* DtoComplexNeg(Type* type, DValue* val)
+{
+    val = DtoComplex(type, val);
+
+    llvm::Value *a, *b, *re, *im;
+
+    // values
+    DtoGetComplexParts(val, a, b);
+
+    // sub up
+    re = gIR->ir->CreateNeg(a, "tmp");
+    im = gIR->ir->CreateNeg(b, "tmp");
+
+    return new DComplexValue(type, re, im);
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////
+
 llvm::Value* DtoComplexEquals(TOK op, DValue* lhs, DValue* rhs)
 {
     Type* type = lhs->getType();