File tree 6 files changed +26
-12
lines changed
6 files changed +26
-12
lines changed Original file line number Diff line number Diff line change @@ -148,6 +148,10 @@ if(MSVC)
148
148
add_definitions (/bigobj) #allow for larger object files
149
149
endif (MSVC )
150
150
151
+ if (WIN32 )
152
+ add_definitions (-D_USE_MATH_DEFINES)
153
+ endif (WIN32 )
154
+
151
155
# Record Compiler Info for record
152
156
STRING (TOUPPER ${CMAKE_BUILD_TYPE} GRCBTU)
153
157
set (COMPILER_INFO "" )
Original file line number Diff line number Diff line change @@ -32,14 +32,9 @@ set(BOOST_REQUIRED_COMPONENTS
32
32
filesystem
33
33
system
34
34
regex
35
+ thread
35
36
)
36
37
37
- if (MINGW)
38
- set (BOOST_REQUIRED_COMPONENTS ${BOOST_REQUIRED_COMPONENTS} thread_win32)
39
- else (MINGW)
40
- set (BOOST_REQUIRED_COMPONENTS ${BOOST_REQUIRED_COMPONENTS} thread)
41
- endif (MINGW)
42
-
43
38
if (UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64" )
44
39
list (APPEND BOOST_LIBRARYDIR "/usr/lib64" ) #fedora 64-bit fix
45
40
endif (UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64" )
Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ typedef ptrdiff_t ssize_t;
21
21
////////////////////////////////////////////////////////////////////////
22
22
// rint functions
23
23
////////////////////////////////////////////////////////////////////////
24
- #define _USE_MATH_DEFINES
25
24
#include <math.h>
26
25
#if _MSC_VER < 1800
27
26
static inline long lrint (double x ){return (long )(x > 0.0 ? x + 0.5 : x - 0.5 );}
@@ -62,7 +61,4 @@ static inline float rintf(float x){return (x > 0.0f)? floorf(x + 0.5f) : ceilf(x
62
61
static inline long int random (void ) { return rand (); }
63
62
static inline void srandom (unsigned int seed ) { srand (seed ); }
64
63
65
- #define srand48 (seed ) srand(seed)
66
- #define drand48 () (double(rand()) / RAND_MAX)
67
-
68
64
#endif // _MSC_CONFIG_H_ ]
Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ namespace gr {
144
144
145
145
@TYPE@ @IMPL_NAME@::sample()
146
146
{
147
- #ifdef __USE_GNU
147
+ #ifdef HAVE_RAND48
148
148
size_t idx = lrand48 () % d_samples.size ();
149
149
#else
150
150
size_t idx = rand () % d_samples.size ();
@@ -153,7 +153,7 @@ namespace gr {
153
153
}
154
154
155
155
#ifndef FASTNOISE_RANDOM_SIGN
156
- #ifdef _MSC_VER
156
+ #ifndef HAVE_RAND48
157
157
#define FASTNOISE_RANDOM_SIGN ((rand()%2 ==0 )?1 :-1 )
158
158
#else
159
159
#define FASTNOISE_RANDOM_SIGN ((lrand48()%2 ==0 )?1 :-1 )
Original file line number Diff line number Diff line change @@ -89,3 +89,10 @@ CHECK_CXX_SOURCE_COMPILES("
89
89
" HAVE_COSF
90
90
)
91
91
GR_ADD_COND_DEF(HAVE_COSF)
92
+
93
+ CHECK_CXX_SOURCE_COMPILES("
94
+ #include <stdlib.h>
95
+ int main(){srand48(0); drand48(); lrand48(); return 0;}
96
+ " HAVE_RAND48
97
+ )
98
+ GR_ADD_COND_DEF(HAVE_RAND48)
Original file line number Diff line number Diff line change @@ -57,7 +57,11 @@ namespace gr {
57
57
d_new_in = 0 ;
58
58
d_last_out = 0 ;
59
59
60
+ #ifdef HAVE_RAND48
60
61
srand48 (time (NULL ));
62
+ #else
63
+ srand (time (NULL ));
64
+ #endif
61
65
}
62
66
63
67
test_tag_variable_rate_ff_impl::~test_tag_variable_rate_ff_impl ()
@@ -78,7 +82,11 @@ namespace gr {
78
82
GR_LOG_DEBUG (d_logger, boost::format (" noutput_items: %1%" ) % noutput_items);
79
83
80
84
if (d_update_once) {
85
+ #ifdef HAVE_RAND48
81
86
if (drand48 () > 0.5 ) {
87
+ #else
88
+ if (rand () > RAND_MAX / 2 ) {
89
+ #endif
82
90
d_rrate += d_update_step;
83
91
}
84
92
else {
@@ -95,7 +103,11 @@ namespace gr {
95
103
while (i < ninput_items[0 ]) {
96
104
97
105
if (!d_update_once) {
106
+ #ifdef HAVE_RAND48
98
107
if (drand48 () > 0.5 ) {
108
+ #else
109
+ if (rand () > RAND_MAX / 2 ) {
110
+ #endif
99
111
d_rrate += d_update_step;
100
112
}
101
113
else {
You can’t perform that action at this time.
0 commit comments