OpenTTD Source 20241224-master-gf74b0cf984
mem_func.hpp File Reference

Functions related to memory operations. More...

#include "math_func.hpp"

Go to the source code of this file.

Functions

template<typename T >
void MemCpyT (T *destination, const T *source, size_t num=1)
 Type-safe version of memcpy().
 
template<typename T >
void MemMoveT (T *destination, const T *source, size_t num=1)
 Type-safe version of memmove().
 
template<typename T >
void MemSetT (T *ptr, uint8_t value, size_t num=1)
 Type-safe version of memset().
 
template<typename T >
int MemCmpT (const T *ptr1, const T *ptr2, size_t num=1)
 Type-safe version of memcmp().
 

Detailed Description

Functions related to memory operations.

Definition in file mem_func.hpp.

Function Documentation

◆ MemCmpT()

template<typename T >
int MemCmpT ( const T *  ptr1,
const T *  ptr2,
size_t  num = 1 
)
inline

Type-safe version of memcmp().

Parameters
ptr1Pointer to the first buffer
ptr2Pointer to the second buffer
numNumber of items to compare. (!not number of bytes!)
Returns
an int value indicating the relationship between the content of the two buffers

Definition at line 63 of file mem_func.hpp.

Referenced by GRFGetSizeOfDataSection(), and MidiFile::ReadSMFHeader().

◆ MemCpyT()

template<typename T >
void MemCpyT ( T *  destination,
const T *  source,
size_t  num = 1 
)
inline

Type-safe version of memcpy().

Parameters
destinationPointer to the destination buffer
sourcePointer to the source buffer
numnumber of items to be copied. (!not number of bytes!)

Definition at line 23 of file mem_func.hpp.

Referenced by OutputBuffer::Add(), NewGRFSpriteLayout::Clone(), NewGRFSpriteLayout::Clone(), Blitter_8bppOptimized::Draw(), and ErrorMessageData::ErrorMessageData().

◆ MemMoveT()

template<typename T >
void MemMoveT ( T *  destination,
const T *  source,
size_t  num = 1 
)
inline

Type-safe version of memmove().

Parameters
destinationPointer to the destination buffer
sourcePointer to the source buffer
numnumber of items to be copied. (!not number of bytes!)

Definition at line 36 of file mem_func.hpp.

◆ MemSetT()

template<typename T >
void MemSetT ( T *  ptr,
uint8_t  value,
size_t  num = 1 
)
inline