Chris@29: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@29: Chris@29: /* Chris@29: bqvec Chris@29: Chris@29: A small library for vector arithmetic and allocation in C++ using Chris@29: raw C pointer arrays. Chris@29: Chris@29: Copyright 2007-2014 Particular Programs Ltd. Chris@29: Chris@29: Permission is hereby granted, free of charge, to any person Chris@29: obtaining a copy of this software and associated documentation Chris@29: files (the "Software"), to deal in the Software without Chris@29: restriction, including without limitation the rights to use, copy, Chris@29: modify, merge, publish, distribute, sublicense, and/or sell copies Chris@29: of the Software, and to permit persons to whom the Software is Chris@29: furnished to do so, subject to the following conditions: Chris@29: Chris@29: The above copyright notice and this permission notice shall be Chris@29: included in all copies or substantial portions of the Software. Chris@29: Chris@29: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, Chris@29: EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF Chris@29: MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND Chris@29: NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR Chris@29: ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF Chris@29: CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION Chris@29: WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Chris@29: Chris@29: Except as contained in this notice, the names of Chris Cannam and Chris@29: Particular Programs Ltd shall not be used in advertising or Chris@29: otherwise to promote the sale, use or other dealings in this Chris@29: Software without prior written authorization. Chris@29: */ Chris@29: Chris@29: #include "Allocators.h" Chris@29: Chris@29: #ifdef HAVE_IPP Chris@29: #include Chris@29: #endif Chris@29: Chris@29: #include Chris@29: using std::cerr; Chris@29: using std::endl; Chris@29: Chris@29: namespace breakfastquay { Chris@29: Chris@29: #ifdef HAVE_IPP Chris@29: Chris@29: template <> Chris@29: float *allocate(size_t count) Chris@29: { Chris@29: float *ptr = ippsMalloc_32f(count); Chris@29: if (!ptr) throw (std::bad_alloc()); Chris@29: return ptr; Chris@29: } Chris@29: Chris@29: template <> Chris@29: double *allocate(size_t count) Chris@29: { Chris@29: double *ptr = ippsMalloc_64f(count); Chris@29: if (!ptr) throw (std::bad_alloc()); Chris@29: return ptr; Chris@29: } Chris@29: Chris@29: template <> Chris@29: void deallocate(float *ptr) Chris@29: { Chris@29: if (ptr) ippsFree((void *)ptr); Chris@29: } Chris@29: Chris@29: template <> Chris@29: void deallocate(double *ptr) Chris@29: { Chris@29: if (ptr) ippsFree((void *)ptr); Chris@29: } Chris@29: Chris@29: #endif Chris@29: Chris@29: } Chris@29: