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/scummsys.h"
26 
27 namespace Common {
28 
49 void memset16(uint16 *dst, uint16 val, size_t count);
50 void memset32(uint32 *dst, uint32 val, size_t count);
51 void memset64(uint64 *dst, uint64 val, size_t count);
52 
58 template<class In, class Type>
59 Type *uninitialized_copy(In first, In last, Type *dst) {
60  while (first != last)
61  new ((void *)dst++) Type(*first++);
62  return dst;
63 }
64 
70 /*template<class Type, class Value>
71 void uninitialized_fill(Type *first, Type *last, const Value &x) {
72  while (first != last)
73  new ((void *)first++) Type(x);
74 }*/
75 
81 template<class Type, class Value>
82 void uninitialized_fill_n(Type *dst, size_t n, const Value &x) {
83  while (n--)
84  new ((void *)dst++) Type(x);
85 }
86 
89 } // End of namespace Common
90 
91 #endif
void memset16(uint16 *dst, uint16 val, size_t count)
Type
Definition: system.h:121
Definition: lobject.h:59
Type * uninitialized_copy(In first, In last, Type *dst)
Definition: memory.h:59
Definition: algorithm.h:29
void uninitialized_fill_n(Type *dst, size_t n, const Value &x)
Definition: memory.h:82