commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r9458 - gnuradio/branches/developers/michaelld/altivec


From: michaelld
Subject: [Commit-gnuradio] r9458 - gnuradio/branches/developers/michaelld/altivec/gnuradio-core/src/lib/filter
Date: Sat, 30 Aug 2008 12:09:04 -0600 (MDT)

Author: michaelld
Date: 2008-08-30 12:09:04 -0600 (Sat, 30 Aug 2008)
New Revision: 9458

Modified:
   
gnuradio/branches/developers/michaelld/altivec/gnuradio-core/src/lib/filter/gr_altivec.h
   
gnuradio/branches/developers/michaelld/altivec/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.cc
Log:
Altivec "vector" and "bool" types are ##undef'ined, requiring the use
of "__vector" and "__bool", in order to provide compatibility with C++
types "std::vector" and "bool".



Modified: 
gnuradio/branches/developers/michaelld/altivec/gnuradio-core/src/lib/filter/gr_altivec.h
===================================================================
--- 
gnuradio/branches/developers/michaelld/altivec/gnuradio-core/src/lib/filter/gr_altivec.h
    2008-08-30 17:59:23 UTC (rev 9457)
+++ 
gnuradio/branches/developers/michaelld/altivec/gnuradio-core/src/lib/filter/gr_altivec.h
    2008-08-30 18:09:04 UTC (rev 9458)
@@ -21,31 +21,39 @@
 #ifndef INCLUDED_GR_ALTIVEC_H
 #define INCLUDED_GR_ALTIVEC_H
 
-#include <altivec.h>
 #include <stddef.h>
 #include <stdio.h>
+#include <altivec.h>
 
 #ifdef __cplusplus
+
+// when compiling in C++, undefing "vector" and "bool" altivec types
+// so that they don't conflict with standard C++ types "std::vector"
+// and "bool".  Use "__vector" and "__bool" for those altivec types.
+
+#undef vector
+#undef bool
+
 extern "C" {
 #endif
 
-#define VS             sizeof(vector float)
-#define FLOATS_PER_VEC (sizeof(vector float)/sizeof(float))
+#define VS             sizeof(__vector float)
+#define FLOATS_PER_VEC (sizeof(__vector float)/sizeof(float))
 
 union v_float_u {
-  vector float v;
-  float                f[FLOATS_PER_VEC];
+  __vector float v;
+  float                 f[FLOATS_PER_VEC];
 };
 
-void gr_print_vector_float(FILE *fp, vector float v);
-void gr_pvf(FILE *fp, const char *label, vector float v);
+void gr_print_vector_float(FILE *fp, __vector float v);
+void gr_pvf(FILE *fp, const char *label, __vector float v);
 
 static inline float
-horizontal_add_f(vector float v)
+horizontal_add_f(__vector float v)
 {
   union v_float_u u;
-  vector float   t0 = vec_add(v, vec_sld(v, v, 8));
-  vector float   t1 = vec_add(t0, vec_sld(t0, t0, 4));
+  __vector float  t0 = vec_add(v, vec_sld(v, v, 8));
+  __vector float  t1 = vec_add(t0, vec_sld(t0, t0, 4));
   u.v = t1;
   return u.f[0];
 }

Modified: 
gnuradio/branches/developers/michaelld/altivec/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.cc
===================================================================
--- 
gnuradio/branches/developers/michaelld/altivec/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.cc
   2008-08-30 17:59:23 UTC (rev 9457)
+++ 
gnuradio/branches/developers/michaelld/altivec/gnuradio-core/src/lib/filter/gr_fir_fff_altivec.cc
   2008-08-30 18:09:04 UTC (rev 9458)
@@ -62,7 +62,7 @@
     d_aligned_taps = 0;
   }
   void *p;
-  int r = posix_memalign(&p,  sizeof(vector float), d_naligned_taps * 
sizeof(d_aligned_taps[0]));
+  int r = posix_memalign(&p,  sizeof(__vector float), d_naligned_taps * 
sizeof(d_aligned_taps[0]));
   if (r != 0){
     throw std::bad_alloc();
   }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]