FastLED
3.9.7
Loading...
Searching...
No Matches
allocator.h
1
2
#pragma once
3
4
#include <stddef.h>
5
#include <string.h>
6
7
8
9
namespace
fl
{
10
11
void
SetLargeBlockAllocator(
void
*(*alloc)(
size_t
),
void
(*free)(
void
*));
12
void
* LargeBlockAllocate(
size_t
size,
bool
zero =
true
);
13
void
LargeBlockDeallocate(
void
* ptr);
14
15
template
<
typename
T>
16
class
LargeBlockAllocator
{
17
public
:
18
static
T* Alloc(
size_t
n) {
19
void
* ptr = LargeBlockAllocate(
sizeof
(T) * n,
true
);
20
return
reinterpret_cast<
T*
>
(ptr);
21
}
22
23
static
void
Free(T* p) {
24
if
(p ==
nullptr
) {
25
return
;
26
}
27
LargeBlockDeallocate(p);
28
}
29
};
30
31
}
// namespace fl
fl::LargeBlockAllocator
Definition
allocator.h:16
fl
Implements a simple red square effect for 2D LED grids.
Definition
crgb.h:16
src
fl
allocator.h
Generated on Fri Dec 20 2024 20:54:48 for FastLED by
1.11.0