ScummVM API documentation
memory.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef COMMON_MEMORY_H
23#define COMMON_MEMORY_H
24
25#include "common/util.h"
26
27namespace Common {
28
49void memset16(uint16 *dst, uint16 val, size_t count);
50void memset32(uint32 *dst, uint32 val, size_t count);
51void memset64(uint64 *dst, uint64 val, size_t count);
52
58template<class In, class Type>
59Type *uninitialized_copy(In first, In last, Type *dst) {
60 while (first != last)
61 new ((void *)dst++) Type(*first++);
62 return dst;
63}
64
70template<class In, class Type>
71Type *uninitialized_move(In first, In last, Type *dst) {
72 while (first != last)
73 new ((void *)dst++) Type(Common::move(*first++));
74 return dst;
75}
76
82/*template<class Type, class Value>
83void uninitialized_fill(Type *first, Type *last, const Value &x) {
84 while (first != last)
85 new ((void *)first++) Type(x);
86}*/
87
93template<class Type, class Value>
94void uninitialized_fill_n(Type *dst, size_t n, const Value &x) {
95 while (n--)
96 new ((void *)dst++) Type(x);
97}
98
101} // End of namespace Common
102
103#endif
Out move(In first, In last, Out dst)
Definition: algorithm.h:109
Type * uninitialized_copy(In first, In last, Type *dst)
Definition: memory.h:59
void uninitialized_fill_n(Type *dst, size_t n, const Value &x)
Definition: memory.h:94
void memset16(uint16 *dst, uint16 val, size_t count)
Type * uninitialized_move(In first, In last, Type *dst)
Definition: memory.h:71
Type
Definition: log.h:33
Definition: algorithm.h:29
Definition: lobject.h:59