diff options
author | Josh Blum | 2011-03-14 09:33:00 -0700 |
---|---|---|
committer | Josh Blum | 2011-03-14 09:33:00 -0700 |
commit | 888beebf6015d9a88dbd1c3c842cf2490899a99b (patch) | |
tree | e87b349a5c1f266603f13969e34d1da2454c390f /volk | |
parent | b013372e7e02461bf5e67845b333030eee164bea (diff) | |
download | gnuradio-888beebf6015d9a88dbd1c3c842cf2490899a99b.tar.gz gnuradio-888beebf6015d9a88dbd1c3c842cf2490899a99b.tar.bz2 gnuradio-888beebf6015d9a88dbd1c3c842cf2490899a99b.zip |
volk: simplify the get new method for the aligned pool
Diffstat (limited to 'volk')
-rw-r--r-- | volk/lib/qa_utils.cc | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/volk/lib/qa_utils.cc b/volk/lib/qa_utils.cc index 710d56fb8..b0f63d2b5 100644 --- a/volk/lib/qa_utils.cc +++ b/volk/lib/qa_utils.cc @@ -6,6 +6,7 @@ //#include <boost/test/unit_test.hpp> #include <iostream> #include <vector> +#include <list> #include <ctime> #include <cmath> #include <boost/lexical_cast.hpp> @@ -14,7 +15,6 @@ #include <volk/volk.h> #include <boost/typeof/typeof.hpp> #include <boost/type_traits.hpp> -#include <boost/shared_array.hpp> float uniform() { return 2.0 * ((float) rand() / RAND_MAX - 0.5); // uniformly (-1, 1) @@ -270,13 +270,11 @@ bool icompare(t *in1, t *in2, unsigned int vlen, unsigned int tol) { class volk_qa_aligned_mem_pool{ public: void *get_new(size_t size, size_t alignment = 16){ - boost::shared_array<char> mem(new char[size + alignment-1]); - size_t ptr = size_t(mem.get() + alignment-1) & ~(alignment-1); - std::memset((void *)ptr, 0x00, size); - _mems.push_back(mem); - return (void *)ptr; + _mems.push_back(std::vector<char>(size + alignment-1, 0)); + size_t ptr = size_t(&_mems.back().front()); + return (void *)((ptr + alignment-1) & ~(alignment-1)); } -private: std::vector<boost::shared_array<char> > _mems; +private: std::list<std::vector<char> > _mems; }; bool run_volk_tests(const int archs[], void (*manual_func)(), std::string name, float tol, float scalar, int vlen, int iter) { |