Line |
Branch |
Exec |
Source |
1 |
|
|
/* GATE PROJECT LICENSE: |
2 |
|
|
+----------------------------------------------------------------------------+ |
3 |
|
|
| Copyright(c) 2018-2025, Stefan Meislinger <sm@opengate.at> | |
4 |
|
|
| All rights reserved. | |
5 |
|
|
| | |
6 |
|
|
| Redistribution and use in source and binary forms, with or without | |
7 |
|
|
| modification, are permitted provided that the following conditions are met:| |
8 |
|
|
| | |
9 |
|
|
| 1. Redistributions of source code must retain the above copyright notice, | |
10 |
|
|
| this list of conditions and the following disclaimer. | |
11 |
|
|
| 2. Redistributions in binary form must reproduce the above copyright | |
12 |
|
|
| notice, this list of conditions and the following disclaimer in the | |
13 |
|
|
| documentation and/or other materials provided with the distribution. | |
14 |
|
|
| | |
15 |
|
|
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"| |
16 |
|
|
| AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
17 |
|
|
| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
18 |
|
|
| ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | |
19 |
|
|
| LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
20 |
|
|
| CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
21 |
|
|
| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
22 |
|
|
| INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
23 |
|
|
| CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
24 |
|
|
| ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
25 |
|
|
| THE POSSIBILITY OF SUCH DAMAGE. | |
26 |
|
|
+----------------------------------------------------------------------------+ |
27 |
|
|
*/ |
28 |
|
|
|
29 |
|
|
#include "gate/memalloc.hpp" |
30 |
|
|
#include "gate/exceptions.hpp" |
31 |
|
|
|
32 |
|
|
namespace gate |
33 |
|
|
{ |
34 |
|
|
|
35 |
|
4 |
void* Mem::alloc(size_t sz) noexcept |
36 |
|
|
{ |
37 |
|
4 |
return gate_mem_alloc(sz); |
38 |
|
|
} |
39 |
|
|
|
40 |
|
1 |
void* Mem::realloc(void* ptr, size_t newsz) noexcept |
41 |
|
|
{ |
42 |
|
1 |
return gate_mem_realloc(ptr, newsz); |
43 |
|
|
} |
44 |
|
|
|
45 |
|
4 |
void Mem::dealloc(void* ptr) noexcept |
46 |
|
|
{ |
47 |
|
4 |
gate_mem_dealloc(ptr); |
48 |
|
4 |
} |
49 |
|
|
|
50 |
|
3338 |
void Mem::clear(void* ptr, size_t size) noexcept |
51 |
|
|
{ |
52 |
|
3338 |
gate_mem_clear(ptr, size); |
53 |
|
3338 |
} |
54 |
|
|
|
55 |
|
1 |
void Mem::fill(void* ptr, char chr, size_t count) noexcept |
56 |
|
|
{ |
57 |
|
1 |
gate_mem_fill(ptr, chr, count); |
58 |
|
1 |
} |
59 |
|
|
|
60 |
|
279 |
void* Mem::copy(void* dst, void const* src, size_t sz) noexcept |
61 |
|
|
{ |
62 |
|
279 |
return gate_mem_copy(dst, src, sz); |
63 |
|
|
} |
64 |
|
|
|
65 |
|
2 |
void* Mem::move(void* dst, void const* src, size_t sz) noexcept |
66 |
|
|
{ |
67 |
|
2 |
return gate_mem_move(dst, src, sz); |
68 |
|
|
} |
69 |
|
|
|
70 |
|
20 |
intptr_t Mem::compare(void const* ptr1, void const* ptr2, size_t sz) noexcept |
71 |
|
|
{ |
72 |
|
20 |
return gate_mem_compare(ptr1, ptr2, sz); |
73 |
|
|
} |
74 |
|
|
|
75 |
|
1 |
void Mem::reverse(void* ptr, size_t sz) noexcept |
76 |
|
|
{ |
77 |
|
1 |
gate_mem_reversebyteorder(ptr, sz); |
78 |
|
1 |
} |
79 |
|
|
|
80 |
|
1 |
void* Mem::copyReverse(void* dst, void const* src, size_t sz) noexcept |
81 |
|
|
{ |
82 |
|
1 |
return gate_mem_copy_reverse(dst, src, sz); |
83 |
|
|
} |
84 |
|
|
|
85 |
|
|
} // end of namespace gate |
86 |
|
|
|
87 |
|
|
|