Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Node-API macros for binary functions #1687

Merged
merged 4 commits into from
Mar 5, 2024

Conversation

aman-095
Copy link
Member

@aman-095 aman-095 commented Mar 4, 2024

Description

What is the purpose of this pull request?

This pull request adds the following macros:

/**
* Invokes a binary function accepting signed 32-bit integers and returning a double-precision floating-point number.
*/
napi_value stdlib_math_base_napi_ii_d( napi_env env, napi_callback_info info, double (*fcn)( int32_t, int32_t ) );

/**
* Invokes a binary function accepting and returning signed 32-bit integers.
*/
napi_value stdlib_math_base_napi_ii_i( napi_env env, napi_callback_info info, int32_t (*fcn)( int32_t, int32_t ) );

Related Issues

Does this pull request have any related issues?

It is a blocker for the C implementation for GCD.

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.


@stdlib-js/reviewers

Copy link
Member

@Pranavchiku Pranavchiku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me as per my knowledge. Thanks @aman-095!

If you wish to read more about Node-API: https://nodejs.org/api/n-api.html

Signed-off-by: Pranav <85227306+Pranavchiku@users.noreply.github.com>
@Pranavchiku Pranavchiku added the Native Addons Issue involves or relates to Node.js native add-ons. label Mar 4, 2024
@Pranavchiku Pranavchiku changed the title feat: Add napi for binary int32_t to double and int32_t to int32_t add Node-API macros for binary functions Mar 4, 2024
@Pranavchiku Pranavchiku changed the title add Node-API macros for binary functions feat: add Node-API macros for binary functions Mar 4, 2024
@Pranavchiku Pranavchiku added Math Issue or pull request specific to math functionality. Ready To Merge A pull request which is ready to be merged. labels Mar 4, 2024
@kgryte kgryte added C Issue involves or relates to C. Utilities Issue or pull request concerning general utilities. and removed Math Issue or pull request specific to math functionality. labels Mar 4, 2024
Signed-off-by: Athan <kgryte@gmail.com>
Copy link
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The README is missing the new macro defns. Once added, this should be ready for merge.

@kgryte kgryte added Needs Changes Pull request which needs changes before being merged. and removed Ready To Merge A pull request which is ready to be merged. labels Mar 4, 2024
@aman-095
Copy link
Member Author

aman-095 commented Mar 4, 2024

@kgryte @Pranavchiku @Planeshifter I have applied changes please review.

Copy link
Member

@Planeshifter Planeshifter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for your contribution!

@Planeshifter Planeshifter added Ready To Merge A pull request which is ready to be merged. and removed Needs Changes Pull request which needs changes before being merged. labels Mar 5, 2024
@Planeshifter Planeshifter merged commit c5b26dc into stdlib-js:develop Mar 5, 2024
6 checks passed
utkrs01 pushed a commit to utkrs01/stdlib that referenced this pull request Mar 7, 2024
PR-URL: stdlib-js#1687

---------

Signed-off-by: Pranav <85227306+Pranavchiku@users.noreply.github.com>
Signed-off-by: Athan Reines <kgryte@gmail.com>
Co-authored-by: Pranav <85227306+Pranavchiku@users.noreply.github.com>
Co-authored-by: Athan Reines <kgryte@gmail.com>
Reviewed-by: Pranav <85227306+Pranavchiku@users.noreply.github.com>
Reviewed-by: Athan Reines <kgryte@gmail.com>
Reviewed-by: Philipp Burckhardt <pburckhardt@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C Issue involves or relates to C. Native Addons Issue involves or relates to Node.js native add-ons. Ready To Merge A pull request which is ready to be merged. Utilities Issue or pull request concerning general utilities.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants