diff options
author | Tom Rondeau | 2011-10-20 10:46:35 -0700 |
---|---|---|
committer | Tom Rondeau | 2011-10-20 10:46:35 -0700 |
commit | ccfac187cf86122be5760cb1e2a0bba3a58821c7 (patch) | |
tree | 10071ac9bf28e2240fd05ab1ba820506ef0cd599 | |
parent | 77a2d01cd2fce5a4e401a217c93fa13b76839162 (diff) | |
download | gnuradio-ccfac187cf86122be5760cb1e2a0bba3a58821c7.tar.gz gnuradio-ccfac187cf86122be5760cb1e2a0bba3a58821c7.tar.bz2 gnuradio-ccfac187cf86122be5760cb1e2a0bba3a58821c7.zip |
volk: fixed signed/unsigned comparison warnings.
-rw-r--r-- | volk/gen/make_c.py | 2 | ||||
-rw-r--r-- | volk/include/volk/volk_32f_index_max_16u_a.h | 2 | ||||
-rw-r--r-- | volk/include/volk/volk_32f_x3_sum_of_poly_32f_a.h | 2 | ||||
-rw-r--r-- | volk/include/volk/volk_32fc_index_max_16u_a.h | 2 | ||||
-rw-r--r-- | volk/include/volk/volk_32fc_x2_conjugate_dot_prod_32fc_a.h | 2 | ||||
-rw-r--r-- | volk/include/volk/volk_32fc_x2_conjugate_dot_prod_32fc_u.h | 2 | ||||
-rw-r--r-- | volk/include/volk/volk_32fc_x2_dot_prod_32fc_a.h | 2 | ||||
-rw-r--r-- | volk/include/volk/volk_32fc_x2_s32f_square_dist_scalar_mult_32f_a.h | 2 | ||||
-rw-r--r-- | volk/include/volk/volk_32fc_x2_square_dist_32f_a.h | 2 | ||||
-rw-r--r-- | volk/lib/qa_utils.cc | 32 | ||||
-rw-r--r-- | volk/lib/volk_rank_archs.c | 6 |
11 files changed, 28 insertions, 28 deletions
diff --git a/volk/gen/make_c.py b/volk/gen/make_c.py index 19d679e71..0f9bcde34 100644 --- a/volk/gen/make_c.py +++ b/volk/gen/make_c.py @@ -52,7 +52,7 @@ struct volk_machine *get_machine(void) { if(machine != NULL) return machine; else { unsigned int max_score = 0; - int i; + unsigned int i; for(i=0; i<n_volk_machines; i++) { if(!(volk_machines[i]->caps & (~volk_get_lvarch()))) { if(volk_machines[i]->caps > max_score) { diff --git a/volk/include/volk/volk_32f_index_max_16u_a.h b/volk/include/volk/volk_32f_index_max_16u_a.h index 3e0cf1d65..0c43a5081 100644 --- a/volk/include/volk/volk_32f_index_max_16u_a.h +++ b/volk/include/volk/volk_32f_index_max_16u_a.h @@ -129,7 +129,7 @@ static inline void volk_32f_index_max_16u_a_generic(unsigned int* target, const float max = src0[0]; unsigned int index = 0; - int i = 1; + unsigned int i = 1; for(; i < num_points; ++i) { diff --git a/volk/include/volk/volk_32f_x3_sum_of_poly_32f_a.h b/volk/include/volk/volk_32f_x3_sum_of_poly_32f_a.h index 2ea8fa96d..153bb3a25 100644 --- a/volk/include/volk/volk_32f_x3_sum_of_poly_32f_a.h +++ b/volk/include/volk/volk_32f_x3_sum_of_poly_32f_a.h @@ -113,7 +113,7 @@ static inline void volk_32f_x3_sum_of_poly_32f_a_generic(float* target, float* s - int i = 0; + unsigned int i = 0; for(; i < num_bytes >> 2; ++i) { fst = src0[i]; diff --git a/volk/include/volk/volk_32fc_index_max_16u_a.h b/volk/include/volk/volk_32fc_index_max_16u_a.h index 312e034e2..9566aa32e 100644 --- a/volk/include/volk/volk_32fc_index_max_16u_a.h +++ b/volk/include/volk/volk_32fc_index_max_16u_a.h @@ -194,7 +194,7 @@ static inline void volk_32fc_index_max_16u_a_generic(unsigned int* target, lv_32 float max = 0.0; unsigned int index = 0; - int i = 0; + unsigned int i = 0; for(; i < num_bytes >> 3; ++i) { diff --git a/volk/include/volk/volk_32fc_x2_conjugate_dot_prod_32fc_a.h b/volk/include/volk/volk_32fc_x2_conjugate_dot_prod_32fc_a.h index a6c21336d..655075528 100644 --- a/volk/include/volk/volk_32fc_x2_conjugate_dot_prod_32fc_a.h +++ b/volk/include/volk/volk_32fc_x2_conjugate_dot_prod_32fc_a.h @@ -21,7 +21,7 @@ static inline void volk_32fc_x2_conjugate_dot_prod_32fc_a_generic(lv_32fc_t* res float sum0[2] = {0,0}; float sum1[2] = {0,0}; - int i = 0; + unsigned int i = 0; for(i = 0; i < n_2_ccomplex_blocks; ++i) { diff --git a/volk/include/volk/volk_32fc_x2_conjugate_dot_prod_32fc_u.h b/volk/include/volk/volk_32fc_x2_conjugate_dot_prod_32fc_u.h index 6b22d9f81..f11c93682 100644 --- a/volk/include/volk/volk_32fc_x2_conjugate_dot_prod_32fc_u.h +++ b/volk/include/volk/volk_32fc_x2_conjugate_dot_prod_32fc_u.h @@ -20,7 +20,7 @@ static inline void volk_32fc_x2_conjugate_dot_prod_32fc_u_generic(lv_32fc_t* res float sum0[2] = {0,0}; float sum1[2] = {0,0}; - int i = 0; + unsigned int i = 0; for(i = 0; i < n_2_ccomplex_blocks; ++i) { diff --git a/volk/include/volk/volk_32fc_x2_dot_prod_32fc_a.h b/volk/include/volk/volk_32fc_x2_dot_prod_32fc_a.h index 022a0a614..a865e0737 100644 --- a/volk/include/volk/volk_32fc_x2_dot_prod_32fc_a.h +++ b/volk/include/volk/volk_32fc_x2_dot_prod_32fc_a.h @@ -22,7 +22,7 @@ static inline void volk_32fc_x2_dot_prod_32fc_a_generic(lv_32fc_t* result, const float sum0[2] = {0,0}; float sum1[2] = {0,0}; - int i = 0; + unsigned int i = 0; for(i = 0; i < n_2_ccomplex_blocks; ++i) { diff --git a/volk/include/volk/volk_32fc_x2_s32f_square_dist_scalar_mult_32f_a.h b/volk/include/volk/volk_32fc_x2_s32f_square_dist_scalar_mult_32f_a.h index be7a4ffe9..2d5f36b27 100644 --- a/volk/include/volk/volk_32fc_x2_s32f_square_dist_scalar_mult_32f_a.h +++ b/volk/include/volk/volk_32fc_x2_s32f_square_dist_scalar_mult_32f_a.h @@ -109,7 +109,7 @@ static inline void volk_32fc_x2_s32f_square_dist_scalar_mult_32f_a_sse3(float* t static inline void volk_32fc_x2_s32f_square_dist_scalar_mult_32f_a_generic(float* target, lv_32fc_t* src0, lv_32fc_t* points, float scalar, unsigned int num_bytes) { lv_32fc_t diff; float sq_dist; - int i = 0; + unsigned int i = 0; for(; i < num_bytes >> 3; ++i) { diff = src0[0] - points[i]; diff --git a/volk/include/volk/volk_32fc_x2_square_dist_32f_a.h b/volk/include/volk/volk_32fc_x2_square_dist_32f_a.h index c21d00491..6a4a08ca5 100644 --- a/volk/include/volk/volk_32fc_x2_square_dist_32f_a.h +++ b/volk/include/volk/volk_32fc_x2_square_dist_32f_a.h @@ -95,7 +95,7 @@ static inline void volk_32fc_x2_square_dist_32f_a_sse3(float* target, lv_32fc_t* static inline void volk_32fc_x2_square_dist_32f_a_generic(float* target, lv_32fc_t* src0, lv_32fc_t* points, unsigned int num_bytes) { lv_32fc_t diff; float sq_dist; - int i = 0; + unsigned int i = 0; for(; i < num_bytes >> 3; ++i) { diff = src0[0] - points[i]; diff --git a/volk/lib/qa_utils.cc b/volk/lib/qa_utils.cc index 7f86dd78b..9bb515e9f 100644 --- a/volk/lib/qa_utils.cc +++ b/volk/lib/qa_utils.cc @@ -35,7 +35,7 @@ void load_random_data(void *data, volk_type_t type, unsigned int n) { } else { float int_max = float(uint64_t(2) << (type.size*8)); if(type.is_signed) int_max /= 2.0; - for(int i=0; i<n; i++) { + for(unsigned int i=0; i<n; i++) { float scaled_rand = (((float) (rand() - (RAND_MAX/2))) / static_cast<float>((RAND_MAX/2))) * int_max; //man i really don't know how to do this in a more clever way, you have to cast down at some point switch(type.size) { @@ -91,7 +91,7 @@ volk_type_t volk_type_from_string(std::string name) { } //get the data size - int last_size_pos = name.find_last_of("0123456789"); + size_t last_size_pos = name.find_last_of("0123456789"); if(last_size_pos < 0) throw std::string("no size spec in type ").append(name); //will throw if malformed int size = boost::lexical_cast<int>(name.substr(0, last_size_pos+1)); @@ -99,7 +99,7 @@ volk_type_t volk_type_from_string(std::string name) { assert(((size % 8) == 0) && (size <= 64) && (size != 0)); type.size = size/8; //in bytes - for(int i=last_size_pos+1; i < name.size(); i++) { + for(size_t i=last_size_pos+1; i < name.size(); i++) { switch (name[i]) { case 'f': type.is_float = true; @@ -202,7 +202,7 @@ template <class t> bool fcompare(t *in1, t *in2, unsigned int vlen, float tol) { bool fail = false; int print_max_errs = 10; - for(int i=0; i<vlen; i++) { + for(unsigned int i=0; i<vlen; i++) { if(((t *)(in1))[i] < 1e-30) continue; //this is a hack: below around here we'll start to get roundoff errors due to limited precision if(fabs(((t *)(in1))[i] - ((t *)(in2))[i])/(((t *)in1)[i]) > tol) { fail=true; @@ -219,7 +219,7 @@ template <class t> bool icompare(t *in1, t *in2, unsigned int vlen, unsigned int tol) { bool fail = false; int print_max_errs = 10; - for(int i=0; i<vlen; i++) { + for(unsigned int i=0; i<vlen; i++) { if(abs(int(((t *)(in1))[i]) - int(((t *)(in2))[i])) > tol) { fail=true; if(print_max_errs-- > 0) { @@ -270,7 +270,7 @@ bool run_volk_tests(struct volk_func_desc desc, //pull the input scalars into their own vector std::vector<volk_type_t> inputsc; - for(int i=0; i<inputsig.size(); i++) { + for(size_t i=0; i<inputsig.size(); i++) { if(inputsig[i].is_scalar) { inputsc.push_back(inputsig[i]); inputsig.erase(inputsig.begin() + i); @@ -284,18 +284,18 @@ bool run_volk_tests(struct volk_func_desc desc, if(!sig.is_scalar) //we don't make buffers for scalars inbuffs.push_back(mem_pool.get_new(vlen*sig.size*(sig.is_complex ? 2 : 1))); } - for(int i=0; i<inbuffs.size(); i++) { + for(size_t i=0; i<inbuffs.size(); i++) { load_random_data(inbuffs[i], inputsig[i], vlen); } //ok let's make a vector of vector of void buffers, which holds the input/output vectors for each arch std::vector<std::vector<void *> > test_data; - for(int i=0; i<arch_list.size(); i++) { + for(size_t i=0; i<arch_list.size(); i++) { std::vector<void *> arch_buffs; - for(int j=0; j<outputsig.size(); j++) { + for(size_t j=0; j<outputsig.size(); j++) { arch_buffs.push_back(mem_pool.get_new(vlen*outputsig[j].size*(outputsig[j].is_complex ? 2 : 1))); } - for(int j=0; j<inputsig.size(); j++) { + for(size_t j=0; j<inputsig.size(); j++) { arch_buffs.push_back(inbuffs[j]); } test_data.push_back(arch_buffs); @@ -308,7 +308,7 @@ bool run_volk_tests(struct volk_func_desc desc, //now run the test clock_t start, end; std::vector<double> profile_times; - for(int i = 0; i < arch_list.size(); i++) { + for(size_t i = 0; i < arch_list.size(); i++) { start = clock(); switch(both_sigs.size()) { @@ -350,8 +350,8 @@ bool run_volk_tests(struct volk_func_desc desc, //and now compare each output to the generic output //first we have to know which output is the generic one, they aren't in order... - int generic_offset=0; - for(int i=0; i<arch_list.size(); i++) + size_t generic_offset=0; + for(size_t i=0; i<arch_list.size(); i++) if(arch_list[i] == "generic") generic_offset=i; //now compare @@ -360,10 +360,10 @@ bool run_volk_tests(struct volk_func_desc desc, bool fail = false; bool fail_global = false; std::vector<bool> arch_results; - for(int i=0; i<arch_list.size(); i++) { + for(size_t i=0; i<arch_list.size(); i++) { fail = false; if(i != generic_offset) { - for(int j=0; j<both_sigs.size(); j++) { + for(size_t j=0; j<both_sigs.size(); j++) { if(both_sigs[j].is_float) { if(both_sigs[j].size == 8) { fail = fcompare((double *) test_data[generic_offset][j], (double *) test_data[i][j], vlen*(both_sigs[j].is_complex ? 2 : 1), tol); @@ -417,7 +417,7 @@ bool run_volk_tests(struct volk_func_desc desc, double best_time = std::numeric_limits<double>::max(); std::string best_arch = "generic"; - for(int i=0; i < arch_list.size(); i++) { + for(size_t i=0; i < arch_list.size(); i++) { if((profile_times[i] < best_time) && arch_results[i]) { best_time = profile_times[i]; best_arch = arch_list[i]; diff --git a/volk/lib/volk_rank_archs.c b/volk/lib/volk_rank_archs.c index e10433fd0..4baa078bc 100644 --- a/volk/lib/volk_rank_archs.c +++ b/volk/lib/volk_rank_archs.c @@ -5,7 +5,7 @@ #include <string.h> unsigned int get_index(const char *indices[], unsigned int n_archs, const char *arch_name) { - int i; + unsigned int i; for(i=0; i<n_archs; i++) { if(!strncmp(indices[i], arch_name, 20)) { return i; @@ -17,10 +17,10 @@ unsigned int get_index(const char *indices[], unsigned int n_archs, const char * } unsigned int volk_rank_archs(const char *indices[], const int* arch_defs, unsigned int n_archs, const char* name, unsigned int arch) { - int i; + unsigned int i; unsigned int best_val = 0; static struct volk_arch_pref *volk_arch_prefs; - static int n_arch_prefs = 0; + static unsigned int n_arch_prefs = 0; static int prefs_loaded = 0; if(!prefs_loaded) { n_arch_prefs = load_preferences(&volk_arch_prefs); |