DDraceNetwork Docs
Memory

Functions

void mem_copy (void *dest, const void *source, size_t size)
 
void mem_move (void *dest, const void *source, size_t size)
 
template<typename T >
void mem_zero (T *block, size_t size)
 
int mem_comp (const void *a, const void *b, size_t size)
 
bool mem_has_null (const void *block, size_t size)
 

Detailed Description

Memory management utilities.

Function Documentation

◆ mem_comp()

int mem_comp ( const void *  a,
const void *  b,
size_t  size 
)

Compares two blocks of memory

Parameters
aFirst block of data
bSecond block of data
sizeSize of the data to compare
Returns
< 0 - Block a is less than block b.
0 - Block a is equal to block b.
> 0 - Block a is greater than block b.

◆ mem_copy()

void mem_copy ( void *  dest,
const void *  source,
size_t  size 
)

Copies a a memory block.

Parameters
destDestination.
sourceSource to copy.
sizeSize of the block to copy.
Remarks
This functions DOES NOT handle cases where the source and destination is overlapping.
See also
mem_move

◆ mem_has_null()

bool mem_has_null ( const void *  block,
size_t  size 
)

Checks whether a block of memory contains null bytes.

Parameters
blockPointer to the block to check for nulls.
sizeSize of the block.
Returns
true if the block has a null byte, false otherwise.

◆ mem_move()

void mem_move ( void *  dest,
const void *  source,
size_t  size 
)

Copies a a memory block.

Parameters
destDestination.
sourceSource to copy.
sizeSize of the block to copy.
Remarks
This functions handles the cases where the source and destination is overlapping.
See also
mem_copy

◆ mem_zero()

template<typename T >
void mem_zero ( T *  block,
size_t  size 
)
inline

Sets a complete memory block to 0.

Parameters
blockPointer to the block to zero out.
sizeSize of the block.