@stdlib/math-base-napi-binary 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +1 -1
- package/README.md +1065 -284
- package/include/stdlib/math/base/napi/binary/bb_b.h +84 -0
- package/include/stdlib/math/base/napi/binary/cc_c.h +98 -0
- package/include/stdlib/math/base/napi/binary/cf_c.h +89 -0
- package/include/stdlib/math/base/napi/binary/ci_c.h +91 -0
- package/include/stdlib/math/base/napi/binary/dd_d.h +81 -0
- package/include/stdlib/math/base/napi/binary/di_d.h +84 -0
- package/include/stdlib/math/base/napi/binary/dz_z.h +89 -0
- package/include/stdlib/math/base/napi/binary/fc_c.h +89 -0
- package/include/stdlib/math/base/napi/binary/ff_f.h +81 -0
- package/include/stdlib/math/base/napi/binary/fi_f.h +84 -0
- package/include/stdlib/math/base/napi/binary/id_d.h +84 -0
- package/include/stdlib/math/base/napi/binary/ii_d.h +84 -0
- package/include/stdlib/math/base/napi/binary/ii_f.h +84 -0
- package/include/stdlib/math/base/napi/binary/ii_i.h +84 -0
- package/include/stdlib/math/base/napi/binary/kk_k.h +84 -0
- package/include/stdlib/math/base/napi/binary/ll_d.h +84 -0
- package/include/stdlib/math/base/napi/binary/ss_s.h +84 -0
- package/include/stdlib/math/base/napi/binary/tt_t.h +84 -0
- package/include/stdlib/math/base/napi/binary/uu_u.h +84 -0
- package/include/stdlib/math/base/napi/binary/zd_z.h +89 -0
- package/include/stdlib/math/base/napi/binary/zi_z.h +91 -0
- package/include/stdlib/math/base/napi/binary/zz_z.h +98 -0
- package/include/stdlib/math/base/napi/binary.h +23 -621
- package/manifest.json +56 -36
- package/package.json +1 -1
- package/src/bb_b.c +84 -0
- package/src/cc_c.c +179 -0
- package/src/cf_c.c +143 -0
- package/src/ci_c.c +143 -0
- package/src/dd_d.c +83 -0
- package/src/di_d.c +84 -0
- package/src/dz_z.c +142 -0
- package/src/fc_c.c +142 -0
- package/src/ff_f.c +83 -0
- package/src/fi_f.c +84 -0
- package/src/id_d.c +84 -0
- package/src/ii_d.c +84 -0
- package/src/ii_f.c +84 -0
- package/src/ii_i.c +84 -0
- package/src/kk_k.c +84 -0
- package/src/ll_d.c +84 -0
- package/src/ss_s.c +84 -0
- package/src/tt_t.c +84 -0
- package/src/uu_u.c +84 -0
- package/src/zd_z.c +142 -0
- package/src/zi_z.c +143 -0
- package/src/zz_z.c +179 -0
- package/src/main.c +0 -1187
|
@@ -19,626 +19,28 @@
|
|
|
19
19
|
#ifndef STDLIB_MATH_BASE_NAPI_BINARY_H
|
|
20
20
|
#define STDLIB_MATH_BASE_NAPI_BINARY_H
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
#include "stdlib/
|
|
24
|
-
#include
|
|
25
|
-
#include
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
#
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
napi_callback_info info \
|
|
46
|
-
) { \
|
|
47
|
-
return stdlib_math_base_napi_dd_d( env, info, fcn ); \
|
|
48
|
-
}; \
|
|
49
|
-
static napi_value stdlib_math_base_napi_dd_d_init( \
|
|
50
|
-
napi_env env, \
|
|
51
|
-
napi_value exports \
|
|
52
|
-
) { \
|
|
53
|
-
napi_value fcn; \
|
|
54
|
-
napi_status status = napi_create_function( \
|
|
55
|
-
env, \
|
|
56
|
-
"exports", \
|
|
57
|
-
NAPI_AUTO_LENGTH, \
|
|
58
|
-
stdlib_math_base_napi_dd_d_wrapper, \
|
|
59
|
-
NULL, \
|
|
60
|
-
&fcn \
|
|
61
|
-
); \
|
|
62
|
-
assert( status == napi_ok ); \
|
|
63
|
-
return fcn; \
|
|
64
|
-
}; \
|
|
65
|
-
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_dd_d_init )
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Macro for registering a Node-API module exporting an interface invoking a binary function accepting and returning signed 32-bit integers.
|
|
69
|
-
*
|
|
70
|
-
* @param fcn binary function
|
|
71
|
-
*
|
|
72
|
-
* @example
|
|
73
|
-
* static int_32 add( const int_32 x, const int_32 y ) {
|
|
74
|
-
* return x + y;
|
|
75
|
-
* }
|
|
76
|
-
*
|
|
77
|
-
* // ...
|
|
78
|
-
*
|
|
79
|
-
* // Register a Node-API module:
|
|
80
|
-
* STDLIB_MATH_BASE_NAPI_MODULE_II_I( add );
|
|
81
|
-
*/
|
|
82
|
-
#define STDLIB_MATH_BASE_NAPI_MODULE_II_I( fcn ) \
|
|
83
|
-
static napi_value stdlib_math_base_napi_ii_i_wrapper( \
|
|
84
|
-
napi_env env, \
|
|
85
|
-
napi_callback_info info \
|
|
86
|
-
) { \
|
|
87
|
-
return stdlib_math_base_napi_ii_i( env, info, fcn ); \
|
|
88
|
-
}; \
|
|
89
|
-
static napi_value stdlib_math_base_napi_ii_i_init( \
|
|
90
|
-
napi_env env, \
|
|
91
|
-
napi_value exports \
|
|
92
|
-
) { \
|
|
93
|
-
napi_value fcn; \
|
|
94
|
-
napi_status status = napi_create_function( \
|
|
95
|
-
env, \
|
|
96
|
-
"exports", \
|
|
97
|
-
NAPI_AUTO_LENGTH, \
|
|
98
|
-
stdlib_math_base_napi_ii_i_wrapper, \
|
|
99
|
-
NULL, \
|
|
100
|
-
&fcn \
|
|
101
|
-
); \
|
|
102
|
-
assert( status == napi_ok ); \
|
|
103
|
-
return fcn; \
|
|
104
|
-
}; \
|
|
105
|
-
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_ii_i_init )
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Macro for registering a Node-API module exporting an interface invoking a binary function accepting signed 32-bit integers and returning a double-precision floating-point number.
|
|
109
|
-
*
|
|
110
|
-
* @param fcn binary function
|
|
111
|
-
*
|
|
112
|
-
* @example
|
|
113
|
-
* static double add( const int_32 x, const int_32 y ) {
|
|
114
|
-
* return x + y;
|
|
115
|
-
* }
|
|
116
|
-
*
|
|
117
|
-
* // ...
|
|
118
|
-
*
|
|
119
|
-
* // Register a Node-API module:
|
|
120
|
-
* STDLIB_MATH_BASE_NAPI_MODULE_II_D( add );
|
|
121
|
-
*/
|
|
122
|
-
#define STDLIB_MATH_BASE_NAPI_MODULE_II_D( fcn ) \
|
|
123
|
-
static napi_value stdlib_math_base_napi_ii_d_wrapper( \
|
|
124
|
-
napi_env env, \
|
|
125
|
-
napi_callback_info info \
|
|
126
|
-
) { \
|
|
127
|
-
return stdlib_math_base_napi_ii_d( env, info, fcn ); \
|
|
128
|
-
}; \
|
|
129
|
-
static napi_value stdlib_math_base_napi_ii_d_init( \
|
|
130
|
-
napi_env env, \
|
|
131
|
-
napi_value exports \
|
|
132
|
-
) { \
|
|
133
|
-
napi_value fcn; \
|
|
134
|
-
napi_status status = napi_create_function( \
|
|
135
|
-
env, \
|
|
136
|
-
"exports", \
|
|
137
|
-
NAPI_AUTO_LENGTH, \
|
|
138
|
-
stdlib_math_base_napi_ii_d_wrapper, \
|
|
139
|
-
NULL, \
|
|
140
|
-
&fcn \
|
|
141
|
-
); \
|
|
142
|
-
assert( status == napi_ok ); \
|
|
143
|
-
return fcn; \
|
|
144
|
-
}; \
|
|
145
|
-
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_ii_d_init )
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Macro for registering a Node-API module exporting an interface invoking a binary function accepting and returning single-precision floating-point numbers.
|
|
149
|
-
*
|
|
150
|
-
* @param fcn binary function
|
|
151
|
-
*
|
|
152
|
-
* @example
|
|
153
|
-
* static float addf( const float x, const float y ) {
|
|
154
|
-
* return x + y;
|
|
155
|
-
* }
|
|
156
|
-
*
|
|
157
|
-
* // ...
|
|
158
|
-
*
|
|
159
|
-
* // Register a Node-API module:
|
|
160
|
-
* STDLIB_MATH_BASE_NAPI_MODULE_FF_F( addf );
|
|
161
|
-
*/
|
|
162
|
-
#define STDLIB_MATH_BASE_NAPI_MODULE_FF_F( fcn ) \
|
|
163
|
-
static napi_value stdlib_math_base_napi_ff_f_wrapper( \
|
|
164
|
-
napi_env env, \
|
|
165
|
-
napi_callback_info info \
|
|
166
|
-
) { \
|
|
167
|
-
return stdlib_math_base_napi_ff_f( env, info, fcn ); \
|
|
168
|
-
}; \
|
|
169
|
-
static napi_value stdlib_math_base_napi_ff_f_init( \
|
|
170
|
-
napi_env env, \
|
|
171
|
-
napi_value exports \
|
|
172
|
-
) { \
|
|
173
|
-
napi_value fcn; \
|
|
174
|
-
napi_status status = napi_create_function( \
|
|
175
|
-
env, \
|
|
176
|
-
"exports", \
|
|
177
|
-
NAPI_AUTO_LENGTH, \
|
|
178
|
-
stdlib_math_base_napi_ff_f_wrapper, \
|
|
179
|
-
NULL, \
|
|
180
|
-
&fcn \
|
|
181
|
-
); \
|
|
182
|
-
assert( status == napi_ok ); \
|
|
183
|
-
return fcn; \
|
|
184
|
-
}; \
|
|
185
|
-
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_ff_f_init )
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Macro for registering a Node-API module exporting an interface invoking a binary function accepting and returning double-precision complex floating-point numbers.
|
|
189
|
-
*
|
|
190
|
-
* @param fcn binary function
|
|
191
|
-
*
|
|
192
|
-
* @example
|
|
193
|
-
* #include "stdlib/complex/float64/ctor.h"
|
|
194
|
-
* #include "stdlib/complex/float64/reim.h"
|
|
195
|
-
*
|
|
196
|
-
* static stdlib_complex128_t add( const stdlib_complex128_t x, const stdlib_complex128_t y ) {
|
|
197
|
-
* double xre;
|
|
198
|
-
* double xim;
|
|
199
|
-
* double yre;
|
|
200
|
-
* double yim;
|
|
201
|
-
* double re;
|
|
202
|
-
* double im;
|
|
203
|
-
*
|
|
204
|
-
* stdlib_complex128_reim( x, &xre, &xim );
|
|
205
|
-
* stdlib_complex128_reim( y, &yre, &yim );
|
|
206
|
-
*
|
|
207
|
-
* re = xre + yre;
|
|
208
|
-
* im = xim + yim;
|
|
209
|
-
*
|
|
210
|
-
* return stdlib_complex128( re, im );
|
|
211
|
-
* }
|
|
212
|
-
*
|
|
213
|
-
* // ...
|
|
214
|
-
*
|
|
215
|
-
* // Register a Node-API module:
|
|
216
|
-
* STDLIB_MATH_BASE_NAPI_MODULE_ZZ_Z( add );
|
|
217
|
-
*/
|
|
218
|
-
#define STDLIB_MATH_BASE_NAPI_MODULE_ZZ_Z( fcn ) \
|
|
219
|
-
static napi_value stdlib_math_base_napi_zz_z_wrapper( \
|
|
220
|
-
napi_env env, \
|
|
221
|
-
napi_callback_info info \
|
|
222
|
-
) { \
|
|
223
|
-
return stdlib_math_base_napi_zz_z( env, info, fcn ); \
|
|
224
|
-
}; \
|
|
225
|
-
static napi_value stdlib_math_base_napi_zz_z_init( \
|
|
226
|
-
napi_env env, \
|
|
227
|
-
napi_value exports \
|
|
228
|
-
) { \
|
|
229
|
-
napi_value fcn; \
|
|
230
|
-
napi_status status = napi_create_function( \
|
|
231
|
-
env, \
|
|
232
|
-
"exports", \
|
|
233
|
-
NAPI_AUTO_LENGTH, \
|
|
234
|
-
stdlib_math_base_napi_zz_z_wrapper, \
|
|
235
|
-
NULL, \
|
|
236
|
-
&fcn \
|
|
237
|
-
); \
|
|
238
|
-
assert( status == napi_ok ); \
|
|
239
|
-
return fcn; \
|
|
240
|
-
}; \
|
|
241
|
-
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_zz_z_init )
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Macro for registering a Node-API module exporting an interface invoking a binary function accepting and returning single-precision complex floating-point numbers.
|
|
245
|
-
*
|
|
246
|
-
* @param fcn binary function
|
|
247
|
-
*
|
|
248
|
-
* @example
|
|
249
|
-
* #include "stdlib/complex/float32/ctor.h"
|
|
250
|
-
* #include "stdlib/complex/float32/reim.h"
|
|
251
|
-
*
|
|
252
|
-
* static stdlib_complex64_t add( const stdlib_complex64_t x, const stdlib_complex64_t y ) {
|
|
253
|
-
* float xre;
|
|
254
|
-
* float xim;
|
|
255
|
-
* float yre;
|
|
256
|
-
* float yim;
|
|
257
|
-
* float re;
|
|
258
|
-
* float im;
|
|
259
|
-
*
|
|
260
|
-
* stdlib_complex64_reim( x, &xre, &xim );
|
|
261
|
-
* stdlib_complex64_reim( y, &yre, &yim );
|
|
262
|
-
*
|
|
263
|
-
* re = xre + yre;
|
|
264
|
-
* im = xim + yim;
|
|
265
|
-
*
|
|
266
|
-
* return stdlib_complex64( re, im );
|
|
267
|
-
* }
|
|
268
|
-
*
|
|
269
|
-
* // ...
|
|
270
|
-
*
|
|
271
|
-
* // Register a Node-API module:
|
|
272
|
-
* STDLIB_MATH_BASE_NAPI_MODULE_CC_C( add );
|
|
273
|
-
*/
|
|
274
|
-
#define STDLIB_MATH_BASE_NAPI_MODULE_CC_C( fcn ) \
|
|
275
|
-
static napi_value stdlib_math_base_napi_cc_c_wrapper( \
|
|
276
|
-
napi_env env, \
|
|
277
|
-
napi_callback_info info \
|
|
278
|
-
) { \
|
|
279
|
-
return stdlib_math_base_napi_cc_c( env, info, fcn ); \
|
|
280
|
-
}; \
|
|
281
|
-
static napi_value stdlib_math_base_napi_cc_c_init( \
|
|
282
|
-
napi_env env, \
|
|
283
|
-
napi_value exports \
|
|
284
|
-
) { \
|
|
285
|
-
napi_value fcn; \
|
|
286
|
-
napi_status status = napi_create_function( \
|
|
287
|
-
env, \
|
|
288
|
-
"exports", \
|
|
289
|
-
NAPI_AUTO_LENGTH, \
|
|
290
|
-
stdlib_math_base_napi_cc_c_wrapper, \
|
|
291
|
-
NULL, \
|
|
292
|
-
&fcn \
|
|
293
|
-
); \
|
|
294
|
-
assert( status == napi_ok ); \
|
|
295
|
-
return fcn; \
|
|
296
|
-
}; \
|
|
297
|
-
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_cc_c_init )
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* Macro for registering a Node-API module exporting an interface invoking a binary function accepting a double-precision floating-point number and a signed 32-bit integer and returning a double-precision floating-point number.
|
|
301
|
-
*
|
|
302
|
-
* @param fcn binary function
|
|
303
|
-
*
|
|
304
|
-
* @example
|
|
305
|
-
* #include <stdint.h>
|
|
306
|
-
*
|
|
307
|
-
* static double mul( const double x, const int32_t n ) {
|
|
308
|
-
* return x * n;
|
|
309
|
-
* }
|
|
310
|
-
*
|
|
311
|
-
* // ...
|
|
312
|
-
*
|
|
313
|
-
* // Register a Node-API module:
|
|
314
|
-
* STDLIB_MATH_BASE_NAPI_MODULE_DI_D( mul );
|
|
315
|
-
*/
|
|
316
|
-
#define STDLIB_MATH_BASE_NAPI_MODULE_DI_D( fcn ) \
|
|
317
|
-
static napi_value stdlib_math_base_napi_di_d_wrapper( \
|
|
318
|
-
napi_env env, \
|
|
319
|
-
napi_callback_info info \
|
|
320
|
-
) { \
|
|
321
|
-
return stdlib_math_base_napi_di_d( env, info, fcn ); \
|
|
322
|
-
}; \
|
|
323
|
-
static napi_value stdlib_math_base_napi_di_d_init( \
|
|
324
|
-
napi_env env, \
|
|
325
|
-
napi_value exports \
|
|
326
|
-
) { \
|
|
327
|
-
napi_value fcn; \
|
|
328
|
-
napi_status status = napi_create_function( \
|
|
329
|
-
env, \
|
|
330
|
-
"exports", \
|
|
331
|
-
NAPI_AUTO_LENGTH, \
|
|
332
|
-
stdlib_math_base_napi_di_d_wrapper, \
|
|
333
|
-
NULL, \
|
|
334
|
-
&fcn \
|
|
335
|
-
); \
|
|
336
|
-
assert( status == napi_ok ); \
|
|
337
|
-
return fcn; \
|
|
338
|
-
}; \
|
|
339
|
-
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_di_d_init )
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
* Macro for registering a Node-API module exporting an interface invoking a binary function accepting a single-precision floating-point number and a signed 32-bit integer and returning a single-precision floating-point number.
|
|
343
|
-
*
|
|
344
|
-
* @param fcn binary function
|
|
345
|
-
*
|
|
346
|
-
* @example
|
|
347
|
-
* #include <stdint.h>
|
|
348
|
-
*
|
|
349
|
-
* static float mulf( const float x, const int32_t n ) {
|
|
350
|
-
* return x * n;
|
|
351
|
-
* }
|
|
352
|
-
*
|
|
353
|
-
* // ...
|
|
354
|
-
*
|
|
355
|
-
* // Register a Node-API module:
|
|
356
|
-
* STDLIB_MATH_BASE_NAPI_MODULE_FI_F( mulf );
|
|
357
|
-
*/
|
|
358
|
-
#define STDLIB_MATH_BASE_NAPI_MODULE_FI_F( fcn ) \
|
|
359
|
-
static napi_value stdlib_math_base_napi_fi_f_wrapper( \
|
|
360
|
-
napi_env env, \
|
|
361
|
-
napi_callback_info info \
|
|
362
|
-
) { \
|
|
363
|
-
return stdlib_math_base_napi_fi_f( env, info, fcn ); \
|
|
364
|
-
}; \
|
|
365
|
-
static napi_value stdlib_math_base_napi_fi_f_init( \
|
|
366
|
-
napi_env env, \
|
|
367
|
-
napi_value exports \
|
|
368
|
-
) { \
|
|
369
|
-
napi_value fcn; \
|
|
370
|
-
napi_status status = napi_create_function( \
|
|
371
|
-
env, \
|
|
372
|
-
"exports", \
|
|
373
|
-
NAPI_AUTO_LENGTH, \
|
|
374
|
-
stdlib_math_base_napi_fi_f_wrapper, \
|
|
375
|
-
NULL, \
|
|
376
|
-
&fcn \
|
|
377
|
-
); \
|
|
378
|
-
assert( status == napi_ok ); \
|
|
379
|
-
return fcn; \
|
|
380
|
-
}; \
|
|
381
|
-
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_fi_f_init )
|
|
382
|
-
|
|
383
|
-
/**
|
|
384
|
-
* Macro for registering a Node-API module exporting an interface invoking a binary function accepting a double-precision complex floating-point number and a signed 32-bit and returning a double-precision complex floating-point number.
|
|
385
|
-
*
|
|
386
|
-
* @param fcn binary function
|
|
387
|
-
*
|
|
388
|
-
* @example
|
|
389
|
-
* #include "stdlib/complex/float64/ctor.h"
|
|
390
|
-
* #include "stdlib/complex/float64/reim.h"
|
|
391
|
-
* #include <stdint.h>
|
|
392
|
-
*
|
|
393
|
-
* static stdlib_complex128_t mul( const stdlib_complex128_t x, const int32_t n ) {
|
|
394
|
-
* double re;
|
|
395
|
-
* double im;
|
|
396
|
-
*
|
|
397
|
-
* stdlib_complex128_reim( x, &re, &im );
|
|
398
|
-
* return stdlib_complex128( re*n, im*n );
|
|
399
|
-
* }
|
|
400
|
-
*
|
|
401
|
-
* // ...
|
|
402
|
-
*
|
|
403
|
-
* // Register a Node-API module:
|
|
404
|
-
* STDLIB_MATH_BASE_NAPI_MODULE_ZI_Z( mul );
|
|
405
|
-
*/
|
|
406
|
-
#define STDLIB_MATH_BASE_NAPI_MODULE_ZI_Z( fcn ) \
|
|
407
|
-
static napi_value stdlib_math_base_napi_zi_z_wrapper( \
|
|
408
|
-
napi_env env, \
|
|
409
|
-
napi_callback_info info \
|
|
410
|
-
) { \
|
|
411
|
-
return stdlib_math_base_napi_zi_z( env, info, fcn ); \
|
|
412
|
-
}; \
|
|
413
|
-
static napi_value stdlib_math_base_napi_zi_z_init( \
|
|
414
|
-
napi_env env, \
|
|
415
|
-
napi_value exports \
|
|
416
|
-
) { \
|
|
417
|
-
napi_value fcn; \
|
|
418
|
-
napi_status status = napi_create_function( \
|
|
419
|
-
env, \
|
|
420
|
-
"exports", \
|
|
421
|
-
NAPI_AUTO_LENGTH, \
|
|
422
|
-
stdlib_math_base_napi_zi_z_wrapper, \
|
|
423
|
-
NULL, \
|
|
424
|
-
&fcn \
|
|
425
|
-
); \
|
|
426
|
-
assert( status == napi_ok ); \
|
|
427
|
-
return fcn; \
|
|
428
|
-
}; \
|
|
429
|
-
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_zi_z_init )
|
|
430
|
-
|
|
431
|
-
/**
|
|
432
|
-
* Macro for registering a Node-API module exporting an interface invoking a binary function accepting a single-precision complex floating-point number and a signed 32-bit integer and returning a single-precision complex floating-point number.
|
|
433
|
-
*
|
|
434
|
-
* @param fcn binary function
|
|
435
|
-
*
|
|
436
|
-
* @example
|
|
437
|
-
* #include "stdlib/complex/float32/ctor.h"
|
|
438
|
-
* #include "stdlib/complex/float32/reim.h"
|
|
439
|
-
* #include <stdint.h>
|
|
440
|
-
*
|
|
441
|
-
* static stdlib_complex64_t mul( const stdlib_complex64_t x, const int32_t n ) {
|
|
442
|
-
* float re;
|
|
443
|
-
* float im;
|
|
444
|
-
*
|
|
445
|
-
* stdlib_complex64_reim( x, &re, &im );
|
|
446
|
-
* return stdlib_complex64( re*n, im*n );
|
|
447
|
-
* }
|
|
448
|
-
*
|
|
449
|
-
* // ...
|
|
450
|
-
*
|
|
451
|
-
* // Register a Node-API module:
|
|
452
|
-
* STDLIB_MATH_BASE_NAPI_MODULE_CI_C( mul );
|
|
453
|
-
*/
|
|
454
|
-
#define STDLIB_MATH_BASE_NAPI_MODULE_CI_C( fcn ) \
|
|
455
|
-
static napi_value stdlib_math_base_napi_ci_c_wrapper( \
|
|
456
|
-
napi_env env, \
|
|
457
|
-
napi_callback_info info \
|
|
458
|
-
) { \
|
|
459
|
-
return stdlib_math_base_napi_ci_c( env, info, fcn ); \
|
|
460
|
-
}; \
|
|
461
|
-
static napi_value stdlib_math_base_napi_ci_c_init( \
|
|
462
|
-
napi_env env, \
|
|
463
|
-
napi_value exports \
|
|
464
|
-
) { \
|
|
465
|
-
napi_value fcn; \
|
|
466
|
-
napi_status status = napi_create_function( \
|
|
467
|
-
env, \
|
|
468
|
-
"exports", \
|
|
469
|
-
NAPI_AUTO_LENGTH, \
|
|
470
|
-
stdlib_math_base_napi_ci_c_wrapper, \
|
|
471
|
-
NULL, \
|
|
472
|
-
&fcn \
|
|
473
|
-
); \
|
|
474
|
-
assert( status == napi_ok ); \
|
|
475
|
-
return fcn; \
|
|
476
|
-
}; \
|
|
477
|
-
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_ci_c_init )
|
|
478
|
-
|
|
479
|
-
/**
|
|
480
|
-
* Macro for registering a Node-API module exporting an interface invoking a binary function accepting a double-precision complex floating-point number and a double-precision floating-point number and returning a double-precision complex floating-point number.
|
|
481
|
-
*
|
|
482
|
-
* @param fcn binary function
|
|
483
|
-
*
|
|
484
|
-
* @example
|
|
485
|
-
* #include "stdlib/complex/float64/ctor.h"
|
|
486
|
-
* #include "stdlib/complex/float64/reim.h"
|
|
487
|
-
*
|
|
488
|
-
* static stdlib_complex128_t mul( const stdlib_complex128_t x, const double n ) {
|
|
489
|
-
* double re;
|
|
490
|
-
* double im;
|
|
491
|
-
*
|
|
492
|
-
* stdlib_complex128_reim( x, &re, &im );
|
|
493
|
-
* return stdlib_complex128( re*n, im*n );
|
|
494
|
-
* }
|
|
495
|
-
*
|
|
496
|
-
* // ...
|
|
497
|
-
*
|
|
498
|
-
* // Register a Node-API module:
|
|
499
|
-
* STDLIB_MATH_BASE_NAPI_MODULE_ZD_Z( mul );
|
|
500
|
-
*/
|
|
501
|
-
#define STDLIB_MATH_BASE_NAPI_MODULE_ZD_Z( fcn ) \
|
|
502
|
-
static napi_value stdlib_math_base_napi_zd_z_wrapper( \
|
|
503
|
-
napi_env env, \
|
|
504
|
-
napi_callback_info info \
|
|
505
|
-
) { \
|
|
506
|
-
return stdlib_math_base_napi_zd_z( env, info, fcn ); \
|
|
507
|
-
}; \
|
|
508
|
-
static napi_value stdlib_math_base_napi_zd_z_init( \
|
|
509
|
-
napi_env env, \
|
|
510
|
-
napi_value exports \
|
|
511
|
-
) { \
|
|
512
|
-
napi_value fcn; \
|
|
513
|
-
napi_status status = napi_create_function( \
|
|
514
|
-
env, \
|
|
515
|
-
"exports", \
|
|
516
|
-
NAPI_AUTO_LENGTH, \
|
|
517
|
-
stdlib_math_base_napi_zd_z_wrapper, \
|
|
518
|
-
NULL, \
|
|
519
|
-
&fcn \
|
|
520
|
-
); \
|
|
521
|
-
assert( status == napi_ok ); \
|
|
522
|
-
return fcn; \
|
|
523
|
-
}; \
|
|
524
|
-
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_zd_z_init )
|
|
525
|
-
|
|
526
|
-
/**
|
|
527
|
-
* Macro for registering a Node-API module exporting an interface invoking a binary function accepting a single-precision complex floating-point number and a single-precision floating-point number and returning a single-precision complex floating-point number.
|
|
528
|
-
*
|
|
529
|
-
* @param fcn binary function
|
|
530
|
-
*
|
|
531
|
-
* @example
|
|
532
|
-
* #include "stdlib/complex/float32/ctor.h"
|
|
533
|
-
* #include "stdlib/complex/float32/reim.h"
|
|
534
|
-
*
|
|
535
|
-
* static stdlib_complex64_t mul( const stdlib_complex64_t x, const float n ) {
|
|
536
|
-
* float re;
|
|
537
|
-
* float im;
|
|
538
|
-
*
|
|
539
|
-
* stdlib_complex64_reim( x, &re, &im );
|
|
540
|
-
* return stdlib_complex64( re*n, im*n );
|
|
541
|
-
* }
|
|
542
|
-
*
|
|
543
|
-
* // ...
|
|
544
|
-
*
|
|
545
|
-
* // Register a Node-API module:
|
|
546
|
-
* STDLIB_MATH_BASE_NAPI_MODULE_CF_C( mul );
|
|
547
|
-
*/
|
|
548
|
-
#define STDLIB_MATH_BASE_NAPI_MODULE_CF_C( fcn ) \
|
|
549
|
-
static napi_value stdlib_math_base_napi_cf_c_wrapper( \
|
|
550
|
-
napi_env env, \
|
|
551
|
-
napi_callback_info info \
|
|
552
|
-
) { \
|
|
553
|
-
return stdlib_math_base_napi_cf_c( env, info, fcn ); \
|
|
554
|
-
}; \
|
|
555
|
-
static napi_value stdlib_math_base_napi_cf_c_init( \
|
|
556
|
-
napi_env env, \
|
|
557
|
-
napi_value exports \
|
|
558
|
-
) { \
|
|
559
|
-
napi_value fcn; \
|
|
560
|
-
napi_status status = napi_create_function( \
|
|
561
|
-
env, \
|
|
562
|
-
"exports", \
|
|
563
|
-
NAPI_AUTO_LENGTH, \
|
|
564
|
-
stdlib_math_base_napi_cf_c_wrapper, \
|
|
565
|
-
NULL, \
|
|
566
|
-
&fcn \
|
|
567
|
-
); \
|
|
568
|
-
assert( status == napi_ok ); \
|
|
569
|
-
return fcn; \
|
|
570
|
-
}; \
|
|
571
|
-
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_cf_c_init )
|
|
572
|
-
|
|
573
|
-
/*
|
|
574
|
-
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
|
|
575
|
-
*/
|
|
576
|
-
#ifdef __cplusplus
|
|
577
|
-
extern "C" {
|
|
578
|
-
#endif
|
|
579
|
-
|
|
580
|
-
/**
|
|
581
|
-
* Invokes a binary function accepting and returning double-precision floating-point numbers.
|
|
582
|
-
*/
|
|
583
|
-
napi_value stdlib_math_base_napi_dd_d( napi_env env, napi_callback_info info, double (*fcn)( double, double ) );
|
|
584
|
-
|
|
585
|
-
/**
|
|
586
|
-
* Invokes a binary function accepting and returning single-precision floating-point numbers.
|
|
587
|
-
*/
|
|
588
|
-
napi_value stdlib_math_base_napi_ff_f( napi_env env, napi_callback_info info, float (*fcn)( float, float ) );
|
|
589
|
-
|
|
590
|
-
/**
|
|
591
|
-
* Invokes a binary function accepting and returning double-precision complex floating-point numbers.
|
|
592
|
-
*/
|
|
593
|
-
napi_value stdlib_math_base_napi_zz_z( napi_env env, napi_callback_info info, stdlib_complex128_t (*fcn)( stdlib_complex128_t, stdlib_complex128_t ) );
|
|
594
|
-
|
|
595
|
-
/**
|
|
596
|
-
* Invokes a binary function accepting and returning single-precision complex floating-point numbers.
|
|
597
|
-
*/
|
|
598
|
-
napi_value stdlib_math_base_napi_cc_c( napi_env env, napi_callback_info info, stdlib_complex64_t (*fcn)( stdlib_complex64_t, stdlib_complex64_t ) );
|
|
599
|
-
|
|
600
|
-
/**
|
|
601
|
-
* Invokes a binary function accepting a double-precision floating-point number and a signed 32-bit integer and returning a double-precision floating-point number.
|
|
602
|
-
*/
|
|
603
|
-
napi_value stdlib_math_base_napi_di_d( napi_env env, napi_callback_info info, double (*fcn)( double, int32_t ) );
|
|
604
|
-
|
|
605
|
-
/**
|
|
606
|
-
* Invokes a binary function accepting signed 32-bit integers and returning a double-precision floating-point number.
|
|
607
|
-
*/
|
|
608
|
-
napi_value stdlib_math_base_napi_ii_d( napi_env env, napi_callback_info info, double (*fcn)( int32_t, int32_t ) );
|
|
609
|
-
|
|
610
|
-
/**
|
|
611
|
-
* Invokes a binary function accepting and returning signed 32-bit integers.
|
|
612
|
-
*/
|
|
613
|
-
napi_value stdlib_math_base_napi_ii_i( napi_env env, napi_callback_info info, int32_t (*fcn)( int32_t, int32_t ) );
|
|
614
|
-
|
|
615
|
-
/**
|
|
616
|
-
* Invokes a binary function accepting a single-precision floating-point number and a signed 32-bit integer and returning a single-precision floating-point number.
|
|
617
|
-
*/
|
|
618
|
-
napi_value stdlib_math_base_napi_fi_f( napi_env env, napi_callback_info info, float (*fcn)( float, int32_t ) );
|
|
619
|
-
|
|
620
|
-
/**
|
|
621
|
-
* Invokes a binary function accepting a double-precision complex floating-point number and a signed 32-bit integer and returning a double-precision complex floating-point number.
|
|
622
|
-
*/
|
|
623
|
-
napi_value stdlib_math_base_napi_zi_z( napi_env env, napi_callback_info info, stdlib_complex128_t (*fcn)( stdlib_complex128_t, int32_t ) );
|
|
624
|
-
|
|
625
|
-
/**
|
|
626
|
-
* Invokes a binary function accepting a single-precision complex floating-point number and a signed 32-bit integer and returning a single-precision complex floating-point number.
|
|
627
|
-
*/
|
|
628
|
-
napi_value stdlib_math_base_napi_ci_c( napi_env env, napi_callback_info info, stdlib_complex64_t (*fcn)( stdlib_complex64_t, int32_t ) );
|
|
629
|
-
|
|
630
|
-
/**
|
|
631
|
-
* Invokes a binary function accepting a double-precision complex floating-point number and a double-precision floating-point number and returning a double-precision complex floating-point number.
|
|
632
|
-
*/
|
|
633
|
-
napi_value stdlib_math_base_napi_zd_z( napi_env env, napi_callback_info info, stdlib_complex128_t (*fcn)( stdlib_complex128_t, double ) );
|
|
634
|
-
|
|
635
|
-
/**
|
|
636
|
-
* Invokes a binary function accepting a single-precision complex floating-point number and a single-precision floating-point number and returning a single-precision complex floating-point number.
|
|
637
|
-
*/
|
|
638
|
-
napi_value stdlib_math_base_napi_cf_c( napi_env env, napi_callback_info info, stdlib_complex64_t (*fcn)( stdlib_complex64_t, float ) );
|
|
639
|
-
|
|
640
|
-
#ifdef __cplusplus
|
|
641
|
-
}
|
|
642
|
-
#endif
|
|
22
|
+
// NOTE: please keep in alphabetical order...
|
|
23
|
+
#include "stdlib/math/base/napi/binary/bb_b.h"
|
|
24
|
+
#include "stdlib/math/base/napi/binary/cc_c.h"
|
|
25
|
+
#include "stdlib/math/base/napi/binary/cf_c.h"
|
|
26
|
+
#include "stdlib/math/base/napi/binary/ci_c.h"
|
|
27
|
+
#include "stdlib/math/base/napi/binary/dd_d.h"
|
|
28
|
+
#include "stdlib/math/base/napi/binary/di_d.h"
|
|
29
|
+
#include "stdlib/math/base/napi/binary/dz_z.h"
|
|
30
|
+
#include "stdlib/math/base/napi/binary/fc_c.h"
|
|
31
|
+
#include "stdlib/math/base/napi/binary/ff_f.h"
|
|
32
|
+
#include "stdlib/math/base/napi/binary/fi_f.h"
|
|
33
|
+
#include "stdlib/math/base/napi/binary/id_d.h"
|
|
34
|
+
#include "stdlib/math/base/napi/binary/ii_d.h"
|
|
35
|
+
#include "stdlib/math/base/napi/binary/ii_f.h"
|
|
36
|
+
#include "stdlib/math/base/napi/binary/ii_i.h"
|
|
37
|
+
#include "stdlib/math/base/napi/binary/kk_k.h"
|
|
38
|
+
#include "stdlib/math/base/napi/binary/ll_d.h"
|
|
39
|
+
#include "stdlib/math/base/napi/binary/ss_s.h"
|
|
40
|
+
#include "stdlib/math/base/napi/binary/tt_t.h"
|
|
41
|
+
#include "stdlib/math/base/napi/binary/uu_u.h"
|
|
42
|
+
#include "stdlib/math/base/napi/binary/zd_z.h"
|
|
43
|
+
#include "stdlib/math/base/napi/binary/zi_z.h"
|
|
44
|
+
#include "stdlib/math/base/napi/binary/zz_z.h"
|
|
643
45
|
|
|
644
46
|
#endif // !STDLIB_MATH_BASE_NAPI_BINARY_H
|