CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
scratch.h
Go to the documentation of this file.
1
35
36#pragma once
37
38#include <cx/cx.h>
39#include <cx/thread/tlscleanup.h>
40#include <cx/utils/compare.h>
41
43#define SCRATCH_NBUFFERS 32
44
46#define SCRATCH_MIN_BUFFER_SIZE 64
47
49#define SCRATCH_MAX_REASONABLE_BUFFER_SIZE 1024
50
51CX_C_BEGIN
52
58
59// Thread-local pointer to scratch buffer state (internal use)
60extern _Thread_local ScratchPerThreadInfo* _scratch_pti;
61
74_Ret_notnull_ void* scratchGet(size_t sz);
75
76CX_C_END
77
Comparison and clamping macros.
void * scratchGet(size_t sz)
#define SCRATCH_NBUFFERS
Number of rotating buffers per thread (must be power of 2)
Definition scratch.h:43
Per-thread scratch buffer state.
Definition scratch.h:54
int32 next
Next buffer index to allocate.
Definition scratch.h:55
void * buf[SCRATCH_NBUFFERS]
Rotating buffer pool.
Definition scratch.h:56