FastLED 3.9.15
Loading...
Searching...
No Matches

◆ trivial_swap()

void fl::vector_basic::trivial_swap ( void * a,
void * b ) const
private

Definition at line 28 of file basic_vector.cpp.hpp.

28 {
29 // Stack buffer for small elements, heap for large
30 char stack_buf[64];
31 void* tmp;
32 bool heap_allocated = false;
33 if (mElementSize <= sizeof(stack_buf)) {
34 tmp = stack_buf;
35 } else {
36 tmp = mResource->allocate(mElementSize);
37 heap_allocated = true;
38 }
39 fl::memcpy(tmp, a, mElementSize);
41 fl::memcpy(b, tmp, mElementSize);
42 if (heap_allocated) {
43 mResource->deallocate(tmp, mElementSize);
44 }
45}
fl::size mElementSize
memory_resource * mResource
void * memcpy(void *dest, const void *src, size_t n) FL_NOEXCEPT

References mElementSize, fl::memcpy(), and mResource.

Referenced by swap_impl().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: