Skip to content
Snippets Groups Projects
Commit 415c44b6 authored by Jan David Mol's avatar Jan David Mol
Browse files

Task #3168: Bugfixes

parent c56cb1e6
No related branches found
No related tags found
No related merge requests found
......@@ -58,7 +58,7 @@ template <typename T, unsigned DIM> class MultiDimArray : public boost::multi_ar
// TODO: Not sure how to handle an exception raised by the constructor of T. The placement
// delete[] will be called, but that's an empty stub.
SuperType(allocate(extents, alignment, allocator, padToAlignment, construct), extents),
SuperType(allocate(nrElements(extents), alignment, allocator, padToAlignment, construct), extents),
allocator(&allocator),
allocated_num_elements(nrElements(extents)),
alignment(alignment),
......@@ -69,7 +69,7 @@ template <typename T, unsigned DIM> class MultiDimArray : public boost::multi_ar
MultiDimArray(const MultiDimArray<T,DIM> &other)
:
SuperType(other.num_elements_ ? allocate(other.extent_list_, other.alignment, *other.allocator, other.padToAlignment, other.construct) : 0, other.extent_list_),
SuperType(other.num_elements_ ? allocate(other.num_elements_, other.alignment, *other.allocator, other.padToAlignment, other.construct) : 0, other.extent_list_),
//new(other.allocator->allocate(padToAlignment ? align(other.num_elements_ * sizeof(T), other.alignment) : other.num_elements_ * sizeof(T), other.alignment))T[other.num_elements_] : 0, other.extent_list_),
allocator(other.allocator),
allocated_num_elements(other.num_elements_),
......@@ -134,7 +134,7 @@ template <typename T, unsigned DIM> class MultiDimArray : public boost::multi_ar
unsigned new_num_elements = nrElements(extents);
if (new_num_elements > allocated_num_elements)
THROW(InterfaceException, "MultiDimArray::resizeInplace: requested to resize to " << new_num_elements << " elements, but only " << allocated_num_elements << " are allocateod");
THROW(InterfaceException, "MultiDimArray::resizeInplace: requested to resize to " << new_num_elements << " elements, but only " << allocated_num_elements << " are allocated");
// only destruct and construct all elements if the number of elements actually changes
if (new_num_elements != this->num_elements_ && construct) {
......@@ -196,14 +196,14 @@ template <typename T, unsigned DIM> class MultiDimArray : public boost::multi_ar
bool padToAlignment;
bool construct;
T *allocate(const ExtentList &extents, size_t alignment, Allocator &allocator, bool padToAlignment, bool construct) const {
T *allocate(size_t nrElements, size_t alignment, Allocator &allocator, bool padToAlignment, bool construct) const {
size_t dataSize = padToAlignment
? align(nrElements(extents) * sizeof(T), alignment)
: nrElements(extents) * sizeof(T);
? align(nrElements * sizeof(T), alignment)
: nrElements * sizeof(T);
T *ptr = static_cast<T*>(allocator.allocate(dataSize, alignment));
return construct ? new(ptr)T[nrElements(extents)] : ptr;
return construct ? new(ptr)T[nrElements] : ptr;
}
// a MultiDimArray made to replace another, using a different shape. Assumes
......
......@@ -1062,6 +1062,8 @@ inline unsigned Parset::nrSlotsInFrame() const
// return default
return maxBeamletsPerRSP(nrBitsPerSample());
}
return nrSlots;
}
inline string Parset::partitionName() const
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment