HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Group_arch_Memory

Files

file  align.h
 

Macros

#define ARCH_MAX_ALIGNMENT_INCREASE
 
#define ARCH_CACHE_LINE_SIZE
 

Functions

size_t ArchAlignMemorySize (size_t nBytes)
 
voidArchAlignMemory (void *base)
 
ARCH_API voidArchAlignedAlloc (size_t alignment, size_t size)
 Aligned memory allocation. More...
 
ARCH_API void ArchAlignedFree (void *ptr)
 Free memory allocated by ArchAlignedAlloc. More...
 

Detailed Description

Macro Definition Documentation

#define ARCH_CACHE_LINE_SIZE

The size of a CPU cache line on the current processor architecture in bytes.

Definition at line 84 of file align.h.

#define ARCH_MAX_ALIGNMENT_INCREASE

Maximum extra space needed for alignment.

The ArchAlignMemorySize() can increase the required memory by no more than ARCH_MAX_ALIGNMENT_INCREASE.

Definition at line 64 of file align.h.

Function Documentation

ARCH_API void* ArchAlignedAlloc ( size_t  alignment,
size_t  size 
)

Aligned memory allocation.

ARCH_API void ArchAlignedFree ( void ptr)

Free memory allocated by ArchAlignedAlloc.

void* ArchAlignMemory ( void base)
inline

Align memory to the next "best" alignment value.

This will take a pointer and bump it to the next ideal alignment boundary that will work for all data types.

Definition at line 72 of file align.h.

size_t ArchAlignMemorySize ( size_t  nBytes)
inline

Return suitably aligned memory size.

Requests to malloc() or ::new for a given size are often rounded upward. Given a request for nBytes bytes of storage, this function returns the amount that would actually be consumed by the system to satisfy it. This is needed for efficient user-defined memory management.

Definition at line 54 of file align.h.