CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches

Macros

#define XA_Align(exp)   ((unsigned int)(exp & XA_LG_ALIGN_MASK))
 
#define XA_Zero   ((unsigned int)0x0040)
 Zero-fills returned memory.
 
#define XA_Opt   XA_Optional(High)
 

Detailed Description

Flags that can be combined and passed to allocation functions to control behavior.

Macro Definition Documentation

◆ XA_Align

#define XA_Align (   exp)    ((unsigned int)(exp & XA_LG_ALIGN_MASK))

Align to a 2^exp byte boundary.

Parameters
expAlignment exponent (1-63)
Returns
Alignment flag for use with allocation functions

Definition at line 88 of file xalloc.h.

◆ XA_Opt

#define XA_Opt   XA_Optional(High)

Allows the function to fail and return NULL rather than triggering an out-of-memory assertion. Recommended but not required if using XA_Align.

May be invoked as XA_Optional(High|Low|None) to inform the allocator how hard it should try to find memory if there is none available. The default if not specified is High.

  • High = Try somewhat hard, it would be nice to have this memory
  • Low = This memory isn't that important, don't try particularly hard
  • None = Don't try at all, simply fail if no memory is available

Definition at line 109 of file xalloc.h.