OpenTTD Source  20240919-master-gdf0233f4c2
mem_func.hpp File Reference
#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(). More...
 
template<typename T >
void MemMoveT (T *destination, const T *source, size_t num=1)
 Type-safe version of memmove(). More...
 
template<typename T >
void MemSetT (T *ptr, uint8_t value, size_t num=1)
 Type-safe version of memset(). More...
 
template<typename T >
int MemCmpT (const T *ptr1, const T *ptr2, size_t num=1)
 Type-safe version of memcmp(). More...
 

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(), and NewGRFSpriteLayout::Clone().

◆ 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

Type-safe version of memset().

Parameters
ptrPointer to the destination buffer
valueValue to be set
numnumber of items to be set (!not number of bytes!)

Definition at line 49 of file mem_func.hpp.

Referenced by DLSFile::LoadFile(), LoadNewGRFSound(), LoadWin32Font(), OpenGLSprite::OpenGLSprite(), DLSFile::ReadDLSWave(), VideoDriver_SDL_OpenGL::ReleaseVideoPointer(), and MusicSystem::SaveCustomPlaylist().