DDraceNetwork Documentation
Loading...
Searching...
No Matches
mem.h
Go to the documentation of this file.
1/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
2/* If you are missing that file, acquire a complete release at teeworlds.com. */
3
4#ifndef BASE_MEM_H
5#define BASE_MEM_H
6
7#include <cstdint>
8#include <cstring>
9#include <type_traits>
10
16
30void mem_copy(void *dest, const void *source, size_t size);
31
45void mem_move(void *dest, const void *source, size_t size);
46
55template<typename T>
56inline void mem_zero(T *block, size_t size)
57{
58 static_assert((std::is_trivially_constructible<T>::value && std::is_trivially_destructible<T>::value) || std::is_fundamental<T>::value);
59 memset(block, 0, size);
60}
61
75int mem_comp(const void *a, const void *b, size_t size);
76
87bool mem_has_null(const void *block, size_t size);
88
89#endif
void mem_zero(T *block, size_t size)
Definition mem.h:56
void mem_copy(void *dest, const void *source, size_t size)
Definition mem.cpp:6
bool mem_has_null(const void *block, size_t size)
Definition mem.cpp:21
void mem_move(void *dest, const void *source, size_t size)
Definition mem.cpp:11
int mem_comp(const void *a, const void *b, size_t size)
Definition mem.cpp:16