forked from dlasalle/domlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdlmem_headers.h
157 lines (99 loc) · 2.75 KB
/
dlmem_headers.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/**
* @file dlmem.h
* @brief Memory functio prototypes
* @author Dominique LaSalle <[email protected]>
* Copyright (c) 2013-2015, Dominique LaSalle
* @version 1
* @date 2013-08-19
*/
/******************************************************************************
* FUNCTION PROTOTYPES *********************************************************
******************************************************************************/
#ifndef DLMEM_STATIC
/* prefixing ugliness */
#define DLMEM_PRE2(prefix,suffix) prefix ## _ ## suffix
#define DLMEM_PRE1(prefix,suffix) DLMEM_PRE2(prefix,suffix)
#define DLMEM_PUB(name) DLMEM_PRE1(DLMEM_PREFIX,name)
#define DLMEM_RPUB(name) DLMEM_PRE1(r,DLMEM_PRE1(DLMEM_PREFIX,name))
DLMEM_TYPE_T * DLMEM_PUB(alloc)(
size_t n);
DLMEM_TYPE_T * DLMEM_PUB(calloc)(
size_t n);
void DLMEM_PUB(copy)(
DLMEM_TYPE_T * __DL_RESTRICT dst,
const DLMEM_TYPE_T * __DL_RESTRICT src,
size_t n);
void DLMEM_PUB(move)(
DLMEM_TYPE_T * __DL_RESTRICT dst,
const DLMEM_TYPE_T * __DL_RESTRICT src,
size_t n);
void DLMEM_PUB(set)(
DLMEM_TYPE_T * dst,
DLMEM_TYPE_T val,
size_t n);
DLMEM_TYPE_T * DLMEM_PUB(init_alloc)(
DLMEM_TYPE_T val,
size_t n);
DLMEM_TYPE_T * DLMEM_PUB(realloc)(
DLMEM_TYPE_T * ptr,
size_t newsize);
DLMEM_TYPE_T * DLMEM_PUB(duplicate)(
const DLMEM_TYPE_T * src,
size_t n);
DLMEM_TYPE_T ** DLMEM_RPUB(alloc)(
size_t n);
DLMEM_TYPE_T ** DLMEM_RPUB(calloc)(
size_t n);
DLMEM_TYPE_T ** DLMEM_RPUB(dalloc)(
void const * vec,
size_t svec,
size_t nvec);
DLMEM_TYPE_T ** DLMEM_RPUB(dcalloc)(
void const * vec,
size_t svec,
size_t nvec);
void DLMEM_RPUB(copy)(
DLMEM_TYPE_T ** __DL_RESTRICT dst,
DLMEM_TYPE_T * const * __DL_RESTRICT src,
size_t n);
void DLMEM_RPUB(move)(
DLMEM_TYPE_T ** dst,
DLMEM_TYPE_T * const * src,
size_t n);
void DLMEM_RPUB(set)(
DLMEM_TYPE_T ** dst,
DLMEM_TYPE_T * val,
size_t n);
DLMEM_TYPE_T ** DLMEM_RPUB(init_alloc)(
DLMEM_TYPE_T * val,
size_t n);
DLMEM_TYPE_T ** DLMEM_RPUB(init_dalloc)(
DLMEM_TYPE_T val,
void const * vec,
size_t svec,
size_t nvec);
DLMEM_TYPE_T ** DLMEM_RPUB(sym_alloc)(
size_t m,
size_t n);
DLMEM_TYPE_T ** DLMEM_RPUB(sym_calloc)(
size_t m,
size_t n);
DLMEM_TYPE_T ** DLMEM_RPUB(sym_init_alloc)(
DLMEM_TYPE_T val,
size_t m,
size_t n);
DLMEM_TYPE_T ** DLMEM_RPUB(realloc)(
DLMEM_TYPE_T ** ptr,
size_t newsize);
void DLMEM_RPUB(free)(
DLMEM_TYPE_T ** ptr,
size_t n);
#undef DLMEM_PRE2
#undef DLMEM_PRE1
#undef DLMEM_PUB
#undef DLMEM_RPUB
#else
#define DLMEM_VISIBILITY static
#include "dlmem_funcs.h"
#undef DLMEM_VISIBILITY
#endif