18#ifndef MBED_CACHEALIGNEDBUFFER_H
19#define MBED_CACHEALIGNEDBUFFER_H
27namespace detail::cab {
48 size_t requiredSizeRoundedUp = (neededCapacity * elementSize + __SCB_DCACHE_LINE_SIZE - 1) & ~((__SCB_DCACHE_LINE_SIZE) - 1);
49 return requiredSizeRoundedUp + __SCB_DCACHE_LINE_SIZE - 1;
52 return neededCapacity * elementSize;
107template<
typename DataT>
135 ptrdiff_t prevCacheLine = ((ptrdiff_t)(buffer - 1)) / __SCB_DCACHE_LINE_SIZE;
138 return reinterpret_cast<DataT *
>((prevCacheLine + 1) * __SCB_DCACHE_LINE_SIZE);
140 return reinterpret_cast<DataT *
>(buffer);
147 typedef DataT *iterator;
148 typedef DataT
const *const_iterator;
209 const_iterator
end()
const
234template<
typename DataT,
size_t BufferSize>
283template<
typename DataT>
293 _heapMem(new uint8_t[detail::cab::getNeededBackingBufferSize(
capacity, sizeof(DataT))]())
304 _heapMem(new uint8_t[detail::cab::getNeededBackingBufferSize(other.
_alignedBufferCapacity, sizeof(DataT))])
314 delete[] this->_heapMem;
324 if (&other ==
this) {
CacheAlignedBuffer is used by Mbed in locations where we need a cache-aligned buffer.
CacheAlignedBuffer type which allocates its backing buffer on the heap.
CacheAlignedBuffer type designed for static allocation.