Skip to content

Commit 50d5e5c

Browse files
committed
Auto-generated commit
1 parent 9a15d63 commit 50d5e5c

9 files changed

Lines changed: 69 additions & 66 deletions

File tree

.editorconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ indent_style = tab
8686
[*.{f,f.txt}]
8787
indent_style = space
8888
indent_size = 2
89-
insert_final_newline = false
9089

9190
# Set properties for shell files:
9291
[*.{sh,sh.txt}]

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
<section class="release" id="unreleased">
66

7-
## Unreleased (2024-12-23)
7+
## Unreleased (2025-01-19)
88

99
<section class="features">
1010

@@ -22,6 +22,7 @@
2222

2323
<details>
2424

25+
- [`452ba64`](https://github.com/stdlib-js/stdlib/commit/452ba64c898cec9c526ae2201aa149086347ec8e) - **refactor:** update `math/base/assert/is-integerf` to follow latest project conventions [(#4629)](https://github.com/stdlib-js/stdlib/pull/4629) _(by Vivek Maurya)_
2526
- [`2ea848b`](https://github.com/stdlib-js/stdlib/commit/2ea848b62b686e1e9d861f7df25ece23a7d80798) - **style:** update to use tabs for indentation _(by Philipp Burckhardt)_
2627
- [`ff25e13`](https://github.com/stdlib-js/stdlib/commit/ff25e1324e1507cc076078e82badce7fdf7915f6) - **docs:** remove excess whitespace _(by Philipp Burckhardt)_
2728
- [`140b517`](https://github.com/stdlib-js/stdlib/commit/140b5172075f08678b84b5f92b7feeacfc777119) - **feat:** add `math/base/assert/is-integerf` _(by Gunj Joshi, Philipp Burckhardt)_
@@ -36,10 +37,11 @@
3637

3738
### Contributors
3839

39-
A total of 2 people contributed to this release. Thank you to the following contributors:
40+
A total of 3 people contributed to this release. Thank you to the following contributors:
4041

4142
- Gunj Joshi
4243
- Philipp Burckhardt
44+
- Vivek Maurya
4345

4446
</section>
4547

CONTRIBUTORS

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ Daniel Killenberger <daniel.killenberger@gmail.com>
2727
Daniel Yu <40680511+Daniel777y@users.noreply.github.com>
2828
Debashis Maharana <debashismaharana7854@gmail.com>
2929
Desh Deepak Kant <118960904+DeshDeepakKant@users.noreply.github.com>
30+
Dev Goel <135586571+corsairier@users.noreply.github.com>
31+
Dhruv Arvind Singh <154677013+DhruvArvindSingh@users.noreply.github.com>
3032
Divyansh Seth <59174836+sethdivyansh@users.noreply.github.com>
3133
Dominic Lim <46486515+domlimm@users.noreply.github.com>
3234
Dominik Moritz <domoritz@gmail.com>
@@ -49,6 +51,7 @@ Joey Reed <joeyrreed@gmail.com>
4951
Jordan Gallivan <115050475+Jordan-Gallivan@users.noreply.github.com>
5052
Joris Labie <joris.labie1@gmail.com>
5153
Justin Dennison <justin1dennison@gmail.com>
54+
Karan Anand <119553199+anandkaranubc@users.noreply.github.com>
5255
Karthik Prakash <116057817+skoriop@users.noreply.github.com>
5356
Kohantika Nath <145763549+kohantikanath@users.noreply.github.com>
5457
Krishnendu Das <86651039+itskdhere@users.noreply.github.com>
@@ -117,7 +120,7 @@ UtkershBasnet <119008923+UtkershBasnet@users.noreply.github.com>
117120
Vaibhav Patel <98279986+noobCoderVP@users.noreply.github.com>
118121
Varad Gupta <varadgupta21@gmail.com>
119122
Vinit Pandit <106718914+MeastroZI@users.noreply.github.com>
120-
Vivek maurya <155618190+vivekmaurya001@users.noreply.github.com>
123+
Vivek Maurya <vm8118134@gmail.com>
121124
Xiaochuan Ye <tap91624@gmail.com>
122125
Yaswanth Kosuru <116426380+yaswanthkosuru@users.noreply.github.com>
123126
Yernar Yergaziyev <yernar.yergaziyev@erg.kz>

NOTICE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Copyright (c) 2016-2024 The Stdlib Authors.
1+
Copyright (c) 2016-2025 The Stdlib Authors.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ See [LICENSE][stdlib-license].
250250
251251
## Copyright
252252
253-
Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
253+
Copyright &copy; 2016-2025. The Stdlib [Authors][stdlib-authors].
254254
255255
</section>
256256

benchmark/c/native/benchmark.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,17 @@ static float rand_float( void ) {
9393
static double benchmark( void ) {
9494
double elapsed;
9595
double t;
96-
float x;
96+
float x[ 100 ];
9797
bool b;
9898
int i;
9999

100+
for ( i = 0; i < 100; i++ ) {
101+
x[ i ] = ( rand_float() * 1000.0f ) - 500.0f;
102+
}
103+
100104
t = tic();
101105
for ( i = 0; i < ITERATIONS; i++ ) {
102-
x = ( rand_float() * 1000.0f ) - 500.0f;
103-
b = stdlib_base_is_integerf( x );
106+
b = stdlib_base_is_integerf( x[ i%100 ] );
104107
if ( b != true && b != false ) {
105108
printf( "should return either true or false\n" );
106109
break;

manifest.json

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
2-
"options": {},
2+
"options": {
3+
"task": "build"
4+
},
35
"fields": [
46
{
57
"field": "src",
@@ -24,6 +26,43 @@
2426
],
2527
"confs": [
2628
{
29+
"task": "build",
30+
"src": [
31+
"./src/main.c"
32+
],
33+
"include": [
34+
"./include"
35+
],
36+
"libraries": [
37+
"-lm"
38+
],
39+
"libpath": [],
40+
"dependencies": [
41+
"@stdlib/math-base-special-floorf",
42+
"@stdlib/napi-export",
43+
"@stdlib/napi-argv",
44+
"@stdlib/napi-argv-double",
45+
"@stdlib/napi-create-int32"
46+
]
47+
},
48+
{
49+
"task": "benchmark",
50+
"src": [
51+
"./src/main.c"
52+
],
53+
"include": [
54+
"./include"
55+
],
56+
"libraries": [
57+
"-lm"
58+
],
59+
"libpath": [],
60+
"dependencies": [
61+
"@stdlib/math-base-special-floorf"
62+
]
63+
},
64+
{
65+
"task": "examples",
2766
"src": [
2867
"./src/main.c"
2968
],

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
},
4242
"dependencies": {
4343
"@stdlib/math-base-special-floorf": "^0.2.2",
44+
"@stdlib/napi-argv": "^0.2.2",
45+
"@stdlib/napi-argv-double": "^0.2.1",
46+
"@stdlib/napi-create-int32": "^0.0.2",
47+
"@stdlib/napi-export": "^0.2.2",
4448
"@stdlib/number-float64-base-to-float32": "^0.2.2",
4549
"@stdlib/utils-library-manifest": "^0.2.2"
4650
},

src/addon.c

Lines changed: 9 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@
1717
*/
1818

1919
#include "stdlib/math/base/assert/is_integerf.h"
20+
#include "stdlib/napi/argv.h"
21+
#include "stdlib/napi/argv_double.h"
22+
#include "stdlib/napi/create_int32.h"
23+
#include "stdlib/napi/export.h"
2024
#include <node_api.h>
2125
#include <stdint.h>
22-
#include <assert.h>
2326

2427
/**
2528
* Receives JavaScript callback invocation data.
@@ -29,60 +32,10 @@
2932
* @return Node-API value
3033
*/
3134
static napi_value addon( napi_env env, napi_callback_info info ) {
32-
napi_status status;
33-
34-
// Get callback arguments:
35-
size_t argc = 1;
36-
napi_value argv[ 1 ];
37-
status = napi_get_cb_info( env, info, &argc, argv, NULL, NULL );
38-
assert( status == napi_ok );
39-
40-
// Check whether we were provided the correct number of arguments:
41-
if ( argc < 1 ) {
42-
status = napi_throw_error( env, NULL, "invalid invocation. Insufficient arguments." );
43-
assert( status == napi_ok );
44-
return NULL;
45-
}
46-
if ( argc > 1 ) {
47-
status = napi_throw_error( env, NULL, "invalid invocation. Too many arguments." );
48-
assert( status == napi_ok );
49-
return NULL;
50-
}
51-
52-
napi_valuetype vtype0;
53-
status = napi_typeof( env, argv[ 0 ], &vtype0 );
54-
assert( status == napi_ok );
55-
if ( vtype0 != napi_number ) {
56-
status = napi_throw_type_error( env, NULL, "invalid argument. First argument must be a number." );
57-
assert( status == napi_ok );
58-
return NULL;
59-
}
60-
61-
double x;
62-
status = napi_get_value_double( env, argv[ 0 ], &x );
63-
assert( status == napi_ok );
64-
65-
bool result = stdlib_base_is_integerf( (float)x );
66-
67-
napi_value v;
68-
status = napi_create_int32( env, (int32_t)result, &v );
69-
assert( status == napi_ok );
70-
71-
return v;
72-
}
73-
74-
/**
75-
* Initializes a Node-API module.
76-
*
77-
* @param env environment under which the function is invoked
78-
* @param exports exports object
79-
* @return main export
80-
*/
81-
static napi_value init( napi_env env, napi_value exports ) {
82-
napi_value fcn;
83-
napi_status status = napi_create_function( env, "exports", NAPI_AUTO_LENGTH, addon, NULL, &fcn );
84-
assert( status == napi_ok );
85-
return fcn;
35+
STDLIB_NAPI_ARGV( env, info, argv, argc, 1 );
36+
STDLIB_NAPI_ARGV_DOUBLE( env, x, argv, 0 );
37+
STDLIB_NAPI_CREATE_INT32( env, (int32_t)stdlib_base_is_integerf( (float)x ), out );
38+
return out;
8639
}
8740

88-
NAPI_MODULE( NODE_GYP_MODULE_NAME, init )
41+
STDLIB_NAPI_MODULE_EXPORT_FCN( addon )

0 commit comments

Comments
 (0)