-
Notifications
You must be signed in to change notification settings - Fork 8k
[RFC] ext/bcmath: Added bcdivmod
#15740
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
Conversation
a0f6c5d
to
26e9759
Compare
dca598e
to
24949ec
Compare
4f0eb7f
to
697baa1
Compare
This didn't make it into beta5🙏 |
d116e8b
to
8d0ecb8
Compare
By optimizing bcdiv processing, more efficient calculations can be made, but the changes will be quite complex, and we have decided that it will not be possible in time for RC1, so decided to make this change in 8.4 as this. |
8d0ecb8
to
39fe82f
Compare
ext/bcmath/bcmath.c
Outdated
|
||
if (scale_param_is_null) { | ||
scale = BCG(bc_precision); | ||
} else if (scale_param < 0 || scale_param > INT_MAX) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use the recently-added helper function for this check now.
ext/bcmath/bcmath.c
Outdated
goto cleanup; | ||
} | ||
|
||
array_init(return_value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're creating a new pair of zvals here. We have a very optimized API to do this as fast as possible: zend_new_pair
.
ext/bcmath/bcmath.c
Outdated
|
||
BC_ARENA_SETUP; | ||
|
||
bc_init_num("); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you initialize quot
and rem
like this instead of setting them to NULL at the declaration site?
ext/bcmath/bcmath.c
Outdated
bcmath_number_obj_t *quot_intern = bcmath_number_new_obj(quot, 0); | ||
bcmath_number_obj_t *rem_intern = bcmath_number_new_obj(rem, scale); | ||
|
||
array_init(return_value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same remark of zend_new_pair
.
@nielsdos |
You forgot the zend_new_pair call for one of the functions |
Oh thanks, I'll fix it! |
@nielsdos |
a3bc521
to
4068d57
Compare
RFC: https://wiki.php.net/rfc/add_bcdivmod_to_bcmath