aboutsummaryrefslogtreecommitdiffstats
path: root/CommonLibs/Vector.h
AgeCommit message (Collapse)AuthorFilesLines
2019-07-22Add SPDX annotationPau Espin Pedrol1-0/+2
Related: OS#3515 Change-Id: I3719bd8dc015569ecd81928fc079e27593cdca09
2018-12-05SigProcLib: Improve Vector buffer allocation messPau Espin Pedrol1-12/+31
Original issue: In order to use SSE instructions, 16-byte aligned memory chunks are needed, and C++ version < C++11 doesn't provide for a native new/delete store. For that reason, memalign() must be used in the implementation of convolve_h_alloc() for some buffers. On the other side, The C++ code relies on C++ "new T[]" operator to allocate a chunk of memory containing an array of class instances. As classes are complex types, they cannot be allocated through C structures (calling malloc). Experimentally can be seen too that it's unreliable and the process will crash during startup if malloc() is used and then a Complex<> deferred from it. Previous implementation allowed for use of convolve_h_alloc or new[] based on how the (signal)Vector is called, because then the buffer is not going to be managed internally. But that's unreliable since resize() calling resize() on it could use "delete" operator on a malloc'ed buffer, and end up having a new new[] allocated buffer. It was also found that some of the callers were actually leaking memory through ASan (because the buffer is not managed by the Vector instance). IMHO best option would be to rewrite all this code using C structures and malloc/free exclusively, since it would make all this cod eeasier to maintain. But for now, let's extend the Vector class to allow specifying an external alloc/free function and let the Vector instance take care of the ownership of the buffer in all scenarios. Change-Id: Ie484a4762a7f77fe1b105188ea03a6f025730b82
2018-09-10Vector: Copy arrays in a sane way for non-trivially copyable typesPau Espin Pedrol1-3/+8
Avoids this type of compilation warnings: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of non-trivially copyable type ‘class Complex<float>’; use copy-assignment or copy-initialization instead [-Werror=class-memaccess] Change-Id: I9724454dfb7b87f74f39074e4004580ac3b5fe5c
2018-09-10cosmetic: Fix trailing whitespace in several filesPau Espin Pedrol1-1/+1
Change-Id: Ibf5a69f0a3a309e87814635fd903b114fe68890c
2018-09-10SigProcLib: Use available copyTo Vector API instead of memcopyPau Espin Pedrol1-1/+1
This change allows to remove some wrong use of code as per compilation warning: osmo-trx/Transceiver52M/sigProcLib.cpp:1266:40: error: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of non-trivially copyable type ‘class Complex<float>’; use copy-assignment or copy-initialization instead [-Werror=class-memaccess] midMidamble->size() * sizeof(complex)); Change-Id: Id446711349bec70fa4e7c8efe0f7f9faf7e4f277
2017-06-19common: Declare explicit Vector move constructorTom Tsou1-2/+2
Vector class already has a semantically odd non-const copy constructor that serves the same function as a C++11 move constructor. Make the move constructor semantics explicit and address Coverity at the same time. Change-Id: I22e0099abe601b0c59beee808f7560837c6977dd Fixes: Coverity CID 170738
2017-03-24vector: Introduce shrink() function to shrink vector size without loosing data.Alexander Chemeris1-0/+7
Change-Id: I9c0ac2715aea1a90c9e6ebcd982522b80a547099
2017-03-24vector: Introduce segmentMove() method to move data inside of a vector.Alexander Chemeris1-0/+15
Change-Id: I2f3f4267b4137a0bc031f27e0f896fba9b9f3433
2013-05-31syncing commonlibs with Many thanks to Michael Iedema for these patches, ↵kurtis.heimerl1-0/+13
makes config a lot better. git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@5655 19bc5d8c-e614-43d4-8b26-e1612bc8e597
2011-10-07Putting the actual OpenBTS P2.8 source code into the public SVN branch.dburgess1-0/+268
git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2242 19bc5d8c-e614-43d4-8b26-e1612bc8e597