From 888beebf6015d9a88dbd1c3c842cf2490899a99b Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 14 Mar 2011 09:33:00 -0700 Subject: volk: simplify the get new method for the aligned pool --- volk/lib/qa_utils.cc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'volk') 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 #include #include +#include #include #include #include @@ -14,7 +15,6 @@ #include #include #include -#include 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 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(size + alignment-1, 0)); + size_t ptr = size_t(&_mems.back().front()); + return (void *)((ptr + alignment-1) & ~(alignment-1)); } -private: std::vector > _mems; +private: std::list > _mems; }; bool run_volk_tests(const int archs[], void (*manual_func)(), std::string name, float tol, float scalar, int vlen, int iter) { -- cgit