commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] [gnuradio] 01/03: Windows compatibility fixes


From: git
Subject: [Commit-gnuradio] [gnuradio] 01/03: Windows compatibility fixes
Date: Tue, 8 Jul 2014 21:27:48 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

jcorgan pushed a commit to branch master
in repository gnuradio.

commit b5006c14e4351d32d033fa13a17925e83ba6a0f6
Author: Nicholas Corgan <address@hidden>
Date:   Tue Jul 8 07:22:36 2014 -0700

    Windows compatibility fixes
    
    * fec/ber_tools: added include and #define necessary to use M_PI
    * qtgui: changed erfc to boost::math::erfc
    * volk: don't try to align with MSVC
---
 gr-fec/lib/ber_tools.cc                      | 11 +++++++++++
 gr-qtgui/lib/ber_sink_b_impl.cc              |  4 ++--
 volk/kernels/volk/volk_8u_x4_conv_k7_r2_8u.h |  4 ++++
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/gr-fec/lib/ber_tools.cc b/gr-fec/lib/ber_tools.cc
index 675932a..043fbef 100644
--- a/gr-fec/lib/ber_tools.cc
+++ b/gr-fec/lib/ber_tools.cc
@@ -20,6 +20,12 @@
  * Boston, MA 02110-1301, USA.
  */
 
+#include <cstdlib>
+#ifdef _MSC_VER
+#define _USE_MATH_DEFINES
+#include <cmath>
+#endif
+
 #include "ber_tools.h"
 
 inline int
@@ -35,8 +41,13 @@ gaussnoise(float *inbuffer, int buffsize, float sigma)
   float udrn1=0.0, udrn2=0.0, noise=0.0;
 
   for(i = 0; i < buffsize;i++) {
+    #ifdef _MSC_VER
+    while((udrn1 = (float)(std::rand())) < 0.0000001);
+    udrn2 = (float)(std::rand());
+    #else
     while((udrn1 = (float)drand48()) < 0.0000001);
     udrn2 = (float)drand48();
+    #endif
     noise = sigma*sqrt(-2*log(udrn1))*cos(2*M_PI*udrn2);
     inbuffer[i] += noise;
   }
diff --git a/gr-qtgui/lib/ber_sink_b_impl.cc b/gr-qtgui/lib/ber_sink_b_impl.cc
index bcbe146..61dec25 100644
--- a/gr-qtgui/lib/ber_sink_b_impl.cc
+++ b/gr-qtgui/lib/ber_sink_b_impl.cc
@@ -21,11 +21,11 @@
  */
 
 #include "ber_sink_b_impl.h"
+#include <boost/math/special_functions/erf.hpp>
 #include <gnuradio/io_signature.h>
 #include <gnuradio/math.h>
 #include <gnuradio/fft/fft.h>
 #include <volk/volk.h>
-//#include <math.h>
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -90,7 +90,7 @@ namespace gr {
       for(size_t i = 0; i < esnos.size(); i++) {
         double e = pow(10.0, esnos[i]/10.0);
         d_esno_buffers[curves][i] = esnos[i];
-        d_ber_buffers[curves][i] = log10(erfc(sqrt(e)));
+        d_ber_buffers[curves][i] = log10(boost::math::erfc(sqrt(e)));
       }
 
 
diff --git a/volk/kernels/volk/volk_8u_x4_conv_k7_r2_8u.h 
b/volk/kernels/volk/volk_8u_x4_conv_k7_r2_8u.h
index 7b29438..ece8cf0 100644
--- a/volk/kernels/volk/volk_8u_x4_conv_k7_r2_8u.h
+++ b/volk/kernels/volk/volk_8u_x4_conv_k7_r2_8u.h
@@ -8,7 +8,11 @@ typedef union {
   unsigned int w[64/*NUMSTATES*//32];
   unsigned short s[64/*NUMSTATES*//16];
   unsigned char c[64/*NUMSTATES*//8];
+#ifdef _MSC_VER
+} decision_t;
+#else
 } decision_t __attribute__ ((aligned (16)));
+#endif
 
 static inline void renormalize(unsigned char* X, unsigned char threshold){
   int NUMSTATES = 64;



reply via email to

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