2 mike 1.1 //
3 // Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a
6 // copy of this software and associated documentation files (the "Software"),
7 // to deal in the Software without restriction, including without limitation
8 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 // and/or sell copies of the Software, and to permit persons to whom the
10 // Software is furnished to do so, subject to the following conditions:
11 //
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
15 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
17 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18 // DEALINGS IN THE SOFTWARE.
19 //
|
72 mike 1.1
73 template<class T, class U>
74 inline void CopyToRaw(T* to, const U* from, Uint32 size)
75 {
76 while (size--)
77 new(to++) T(*from++);
78 }
79
80 inline void CopyToRaw(Boolean* to, const Boolean* from, Uint32 size)
81 {
82 memcpy(to, from, sizeof(Boolean) * size);
83 }
84
85 inline void CopyToRaw(Uint8* to, const Uint8* from, Uint32 size)
86 {
87 memcpy(to, from, sizeof(Uint8) * size);
88 }
89
90 inline void CopyToRaw(Sint8* to, const Sint8* from, Uint32 size)
91 {
92 memcpy(to, from, sizeof(Sint8) * size);
93 mike 1.1 }
94
95 inline void CopyToRaw(Uint16* to, const Uint16* from, Uint32 size)
96 {
97 memcpy(to, from, sizeof(Uint16) * size);
98 }
99
100 inline void CopyToRaw(Sint16* to, const Sint16* from, Uint32 size)
101 {
102 memcpy(to, from, sizeof(Sint16) * size);
103 }
104
105 inline void CopyToRaw(Uint32* to, const Uint32* from, Uint32 size)
106 {
107 memcpy(to, from, sizeof(Uint32) * size);
108 }
109
110 inline void CopyToRaw(Sint32* to, const Sint32* from, Uint32 size)
111 {
112 memcpy(to, from, sizeof(Sint32) * size);
113 }
114 mike 1.1
115 inline void CopyToRaw(Uint64* to, const Uint64* from, Uint32 size)
116 {
117 memcpy(to, from, sizeof(Uint64) * size);
118 }
119
120 inline void CopyToRaw(Sint64* to, const Sint64* from, Uint32 size)
121 {
122 memcpy(to, from, sizeof(Sint64) * size);
123 }
124
125 inline void CopyToRaw(Real32* to, const Real32* from, Uint32 size)
126 {
127 memcpy(to, from, sizeof(Real32) * size);
128 }
129
130 inline void CopyToRaw(Real64* to, const Real64* from, Uint32 size)
131 {
132 memcpy(to, from, sizeof(Real64) * size);
133 }
134
135 mike 1.1 inline void CopyToRaw(Char16* to, const Char16* from, Uint32 size)
136 {
137 memcpy(to, from, sizeof(Char16) * size);
138 }
139
140 template<class T>
141 inline void InitializeRaw(T* items, Uint32 size)
142 {
143 while (size--)
144 items++->~T();
145 }
146
|