diff options
author | Tom Rondeau | 2011-08-27 16:44:32 -0400 |
---|---|---|
committer | Tom Rondeau | 2011-08-27 16:44:32 -0400 |
commit | 54881f8803d4f796dde2af031e6f1a37df9445f1 (patch) | |
tree | b1e4e6c34004f22a29c03815ed3ae49065693dce /volk/lib/volk_rank_archs.c | |
parent | 50cde24aea52d66d69313a490f7eab78a5085849 (diff) | |
parent | f4cc7884c608a7ec1969e68b73e12cdbcc26145c (diff) | |
download | gnuradio-54881f8803d4f796dde2af031e6f1a37df9445f1.tar.gz gnuradio-54881f8803d4f796dde2af031e6f1a37df9445f1.tar.bz2 gnuradio-54881f8803d4f796dde2af031e6f1a37df9445f1.zip |
Merge branch 'master' of gnuradio.org:gnuradio
Diffstat (limited to 'volk/lib/volk_rank_archs.c')
-rw-r--r-- | volk/lib/volk_rank_archs.c | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/volk/lib/volk_rank_archs.c b/volk/lib/volk_rank_archs.c index b1a93db26..e10433fd0 100644 --- a/volk/lib/volk_rank_archs.c +++ b/volk/lib/volk_rank_archs.c @@ -1,10 +1,40 @@ -#include<volk_rank_archs.h> -#include<stdio.h> +#include <volk_rank_archs.h> +#include <volk/volk_prefs.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> -unsigned int volk_rank_archs(const int* arch_defs, unsigned int arch) { - int i = 2; +unsigned int get_index(const char *indices[], unsigned int n_archs, const char *arch_name) { + int i; + for(i=0; i<n_archs; i++) { + if(!strncmp(indices[i], arch_name, 20)) { + return i; + } + } + //something terrible should happen here + printf("Volk warning: no arch found, returning generic impl\n"); + return get_index(indices, n_archs, "generic"); //but we'll fake it for now +} + +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 best_val = 0; - for(; i < arch_defs[0] + 1; ++i) { + static struct volk_arch_pref *volk_arch_prefs; + static int n_arch_prefs = 0; + static int prefs_loaded = 0; + if(!prefs_loaded) { + n_arch_prefs = load_preferences(&volk_arch_prefs); + prefs_loaded = 1; + } + + //now look for the function name in the prefs list + for(i=0; i < n_arch_prefs; i++) { + if(!strncmp(name, volk_arch_prefs[i].name, 128)) { //found it + return get_index(indices, n_archs, volk_arch_prefs[i].arch); + } + } + + for(i=1; i < n_archs; ++i) { if((arch_defs[i]&(!arch)) == 0) { best_val = (arch_defs[i] > arch_defs[best_val + 1]) ? i-1 : best_val; } |