[llvm-commits] CVS: llvm/test/Programs/SingleSource/Benchmarks/Misc/mandel.c

Misha Brukman brukman at cs.uiuc.edu
Tue Jul 20 09:04:11 PDT 2004



Changes in directory llvm/test/Programs/SingleSource/Benchmarks/Misc:

mandel.c updated: 1.8 -> 1.9

---
Log message:

Some platforms (e.g., MacOS X) define cabs() as:
  struct {double x, y;} z;
  double cabs(z);
cabs(z) == hypot(x,y) == sqrt(x*x+y*y), so rewrite to be more portable.


---
Diffs of the changes:  (+3 -3)

Index: llvm/test/Programs/SingleSource/Benchmarks/Misc/mandel.c
diff -u llvm/test/Programs/SingleSource/Benchmarks/Misc/mandel.c:1.8 llvm/test/Programs/SingleSource/Benchmarks/Misc/mandel.c:1.9
--- llvm/test/Programs/SingleSource/Benchmarks/Misc/mandel.c:1.8	Tue Jun 22 14:00:55 2004
+++ llvm/test/Programs/SingleSource/Benchmarks/Misc/mandel.c	Tue Jul 20 11:04:01 2004
@@ -14,9 +14,9 @@
 
 #define I 1.0iF
 
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__APPLE__)
 #include <stdio.h>
-#include <complex.h>
+#include <math.h>
 #else
 #include <tgmath.h>
 #endif
@@ -35,7 +35,7 @@
 
       for (n = 0; n < MAX_ITER; ++n) {
         z = z * z + c;
-        if (cabs(z) >= ESCAPE)
+        if (hypot(__real__ z, __imag__ z) >= ESCAPE)
           break;
       }
       emit(z);





More information about the llvm-commits mailing list