OpenTTD Source 20250426-master-gbb1d561369
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 MemSetT (T *ptr, uint8_t value, size_t num=1)
 Type-safe version of memset().
 

Detailed Description

Functions related to memory operations.

Definition in file mem_func.hpp.

Function Documentation

◆ 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 Blitter_8bppOptimized::Draw().

◆ 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 36 of file mem_func.hpp.

Referenced by Blitter_8bppOptimized::Draw(), DLSFile::LoadFile(), LoadWin32Font(), StringReader::ParseFile(), DLSFile::ReadDLSWave(), MusicSystem::SaveCustomPlaylist(), and MusicDriver_DMusic::Start().