File tree 4 files changed +21
-5
lines changed
4 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,4 @@ static inline float rintf(float x){return (x > 0.0f)? floorf(x + 0.5f) : ceilf(x
61
61
static inline long int random (void ) { return rand (); }
62
62
static inline void srandom (unsigned int seed ) { srand (seed ); }
63
63
64
- #define srand48 (seed ) srand(seed)
65
- #define drand48 () (double(rand()) / RAND_MAX)
66
-
67
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