Skip to content

Commit 24e8402

Browse files
author
Aadish Jain
committed
feat(binomial-cdf): made the suggested changes
1 parent b3dfd2d commit 24e8402

File tree

2 files changed

+47
-2
lines changed
  • lib/node_modules/@stdlib
    • math/base/napi/ternary/include/stdlib/math/base/napi
    • stats/base/dists/binomial/cdf/src

2 files changed

+47
-2
lines changed

lib/node_modules/@stdlib/math/base/napi/ternary/include/stdlib/math/base/napi/ternary.h

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,48 @@
144144
}; \
145145
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_dii_d_init )
146146

147+
/**
148+
* Macro for registering a Node-API module exporting an interface invoking a ternary function accepting a double-precision floating-point number and two signed 64-bit integers and returning a double-precision floating-point number.
149+
*
150+
* @param fcn ternary function
151+
*
152+
* @example
153+
* #include <stdint.h>
154+
*
155+
* static double fcn( const double x, const int_64 y, const int_64 z ) {
156+
* // ...
157+
* }
158+
*
159+
* // ...
160+
*
161+
* // Register a Node-API module:
162+
* STDLIB_MATH_BASE_NAPI_MODULE_DLL_D( fcn );
163+
*/
164+
#define STDLIB_MATH_BASE_NAPI_MODULE_DLL_D( fcn ) \
165+
static napi_value stdlib_math_base_napi_dll_d_wrapper( \
166+
napi_env env, \
167+
napi_callback_info info \
168+
) { \
169+
return stdlib_math_base_napi_dll_d( env, info, fcn ); \
170+
}; \
171+
static napi_value stdlib_math_base_napi_dll_d_init( \
172+
napi_env env, \
173+
napi_value exports \
174+
) { \
175+
napi_value fcn; \
176+
napi_status status = napi_create_function( \
177+
env, \
178+
"exports", \
179+
NAPI_AUTO_LENGTH, \
180+
stdlib_math_base_napi_dll_d_wrapper, \
181+
NULL, \
182+
&fcn \
183+
); \
184+
assert( status == napi_ok ); \
185+
return fcn; \
186+
}; \
187+
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_dll_d_init )
188+
147189
/*
148190
* If C++, prevent name mangling so that the compiler emits a ternary file having undecorated names, thus mirroring the behavior of a C compiler.
149191
*/
@@ -165,6 +207,10 @@ napi_value stdlib_math_base_napi_fff_f( napi_env env, napi_callback_info info, f
165207
* Invokes a ternary function accepting a double-precision floating-point number and two signed 32-bit integers and returning a double-precision floating-point number.
166208
*/
167209
napi_value stdlib_math_base_napi_dii_d( napi_env env, napi_callback_info info, double (*fcn)( double, int32_t, int32_t ) );
210+
/**
211+
* Invokes a ternary function accepting a double-precision floating-point number and two signed 64-bit integers and returning a double-precision floating-point number.
212+
*/
213+
napi_value stdlib_math_base_napi_dll_d( napi_env env, napi_callback_info info, double (*fcn)( double, int64_t, int64_t ) );
168214

169215
#ifdef __cplusplus
170216
}

lib/node_modules/@stdlib/stats/base/dists/binomial/cdf/src/addon.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
*/
1818
#include "stdlib/math/base/napi/ternary.h"
1919
#include "stdlib/stats/base/dists/binomial/cdf.h"
20-
#include <stdint.h>
2120

2221
// cppcheck-suppress shadowFunction
23-
STDLIB_MATH_BASE_NAPI_MODULE_DII_D( stdlib_base_dists_binomial_cdf )
22+
STDLIB_MATH_BASE_NAPI_MODULE_DLL_D( stdlib_base_dists_binomial_cdf )

0 commit comments

Comments
 (0)