Arnaud Le Blanc
d16e6f52a4
Generate C enums from internal enums, introduce Z_PARAM_ENUM() ( #20917 )
...
Update gen_stubs.php to generate C enums from internal enums, when the stub is annotated with @generate-c-enums. Enum values can be compared to the result of zend_enum_fetch_case_id(zend_object*).
The generated enums are added to separate files named {$extensionName}_decl.h, so that it's possible to include these from anywhere. _arginfo.h files would generate warnings if we tried to include them in a compilation unit that doesn't call the register_{$class} functions, for instance.
Introduce Z_PARAM_ENUM().
* Make ZEND_AST_CONST_ENUM_INIT a 4-children node
* Store enum case id in ZEND_AST_CONST_ENUM_INIT
* Store enum case id in instance
* Expose enum case_id internally
* Generate C enum for internal enums
* Introduce Z_PARAM_ENUM()
* Port extensions
2026-02-03 12:38:04 +01:00
Arnaud Le Blanc
65b4073922
Include the actual stub name in generated arginfo headers ( #20993 )
2026-01-21 20:57:00 +01:00
Niels Dossche
57ce245e1e
Reduce code bloat in arginfo by using specialised string releases ( #20016 )
...
* Reduce code bloat in arginfo by using specialised string releases
Comparing this patch to master (c7da728574 ),
with a plain configure command without any options:
```
text data bss dec hex filename
20683738 1592400 137712 22413850 156021a sapi/cli/php
20688522 1592400 137712 22418634 15614ca sapi/cli/php_old
```
We see a minor reduction of 0.023% in code size.
* Also use true for the other initialization line
* Also use specialized code for consts
2025-10-02 22:00:20 +02:00
Niels Dossche
a380dcae4d
Fix GH-20006: Power of 0 of BcMath number causes UB
...
Closes GH-20007.
2025-09-30 14:47:35 +02:00
Saki Takamachi
edfd55c197
ext/bcmath: use vector in compare ( #18859 )
2025-06-21 01:34:42 +09:00
Saki Takamachi
2751064692
use XSSE for bcmath ( #18770 )
2025-06-06 08:25:52 +09:00
Niels Dossche
25e60d6ab1
Merge branch 'PHP-8.4'
...
* PHP-8.4:
Fix memory leak when calloc() fails in php_readline_completion_cb()
Fix GH-18641: Accessing a BcMath\Number property by ref crashes
2025-05-24 20:39:59 +02:00
Niels Dossche
64d511ef29
Fix GH-18641: Accessing a BcMath\Number property by ref crashes
...
The properties are virtual so we need a custom get_property_ptr_ptr
handler.
Closes GH-18637.
2025-05-24 20:38:33 +02:00
Saki Takamachi
c5f3281446
ext/bcmath: Improving bcpow() performance ( #18099 )
2025-04-30 08:05:28 +09:00
Saki Takamachi
c927d24af6
ext/bcmath: Use const qualifiers appropriately ( #18284 )
2025-04-11 12:39:31 +09:00
Saki Takamachi
1ce79eb219
ext/bcmath: In the arm processor environment, NEON is used to use SIMD. ( #18130 )
2025-03-26 07:48:02 +09:00
Saki Takamachi
fb07c62f2c
ext/bcmath: Extracted common logic into function and macro ( #18103 )
2025-03-19 18:10:12 +09:00
Saki Takamachi
6b6fde9098
ext/bcmath: If size of BC_VECTOR array is within 64 bytes, stack area is now used ( #18065 )
2025-03-15 08:43:43 +09:00
Saki Takamachi
843d2a9b5f
ext/bcmath: bc_divide() small fix ( #18060 )
2025-03-15 08:41:14 +09:00
Saki Takamachi
32547f1127
ext/bcmath: If the result is 0, n_scale is set to 0. ( #18056 )
2025-03-14 17:52:50 +09:00
Saki Takamachi
fa1effdb3c
Merge branch 'PHP-8.4'
...
* PHP-8.4:
Fixed pointer subtraction for scale (#17986 )
2025-03-14 09:00:33 +09:00
Saki Takamachi
7c9872e255
Fixed pointer subtraction for scale ( #17986 )
...
Closes #17986
2025-03-14 09:00:00 +09:00
Saki Takamachi
4e4f1729dd
ext/bcmath: Simplify bc_divide() code ( #17987 )
...
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com >
2025-03-14 08:53:48 +09:00
Saki Takamachi
5bf6e2e378
Merge branch 'PHP-8.4'
...
* PHP-8.4:
follow up for #17615
2025-01-29 19:25:05 +09:00
Saki Takamachi
18d96671a5
follow up for #17615
...
The deleted line has returned, so delete it again.
2025-01-29 19:25:03 +09:00
Saki Takamachi
c9fa625e41
Merge branch 'PHP-8.4'
...
* PHP-8.4:
Fixed GH-17398: bcmul memory leak (#17615 )
2025-01-29 19:15:23 +09:00
Saki Takamachi
4c90bb2da4
Merge branch 'PHP-8.3' into PHP-8.4
...
* PHP-8.3:
Fixed GH-17398: bcmul memory leak (#17615 )
2025-01-29 19:15:10 +09:00
Saki Takamachi
5a4832f97b
Fixed GH-17398: bcmul memory leak ( #17615 )
...
Changed BCG memory allocation to be forcibly released in
PHP_GSHUTDOWN_FUNCTION regardless of refcount.
Fixes #17398
Closes #17615
2025-01-29 19:12:18 +09:00
Saki Takamachi
2b36680f0a
Merge branch 'PHP-8.4'
...
* PHP-8.4:
Fixed GH-17275: Fixed the calculation logic of dividend scale (#17279 )
2024-12-27 21:36:36 +09:00
Saki Takamachi
ef036090d9
Fixed GH-17275: Fixed the calculation logic of dividend scale ( #17279 )
...
Fixes #17275
Closes #17279
2024-12-27 21:36:26 +09:00
Saki Takamachi
0507b83360
Merge branch 'PHP-8.4'
...
* PHP-8.4:
Correctly round rounding mode with zero edge case (#17065 )
2024-12-17 00:17:38 +09:00
Saki Takamachi
52ebdfbe00
Correctly round rounding mode with zero edge case ( #17065 )
...
Fixes #17064
Closes #17065
2024-12-17 00:17:23 +09:00
Saki Takamachi
2bf3db0907
Merge branch 'PHP-8.4'
...
* PHP-8.4:
Now `Number::round()` does not remove trailing zeros (#17063 )
2024-12-07 02:00:22 +09:00
Saki Takamachi
b88dcc9f3e
Now Number::round() does not remove trailing zeros ( #17063 )
...
Fixes #17061
Closes #17063
2024-12-07 02:00:04 +09:00
Saki Takamachi
bb13556240
Merge branch 'PHP-8.4'
...
* PHP-8.4:
Correctly compare 0 and -0 (#17051 )
2024-12-07 01:52:44 +09:00
Saki Takamachi
063c3c8522
Correctly compare 0 and -0 ( #17051 )
...
Fixes #17049
Closes #17051
2024-12-07 01:52:30 +09:00
Saki Takamachi
5930278702
Merge branch 'PHP-8.4'
...
* PHP-8.4:
Fixed GH-16978: Avoid unnecessary padding with leading zeros (#16988 )
2024-11-29 21:28:48 +09:00
Saki Takamachi
d17ed3445d
Fixed GH-16978: Avoid unnecessary padding with leading zeros ( #16988 )
...
Fixed an issue where leading zeros were padded beyond the allocated memory.
fixes #16978
closes #16988
2024-11-29 21:28:38 +09:00
Saki Takamachi
9b3af0253f
Merge branch 'PHP-8.4'
...
* PHP-8.4:
Fixed a bug in BcMath\Number::pow() and bcpow() when raising negative powers of 0. (#16694 )
2024-11-20 00:17:38 +09:00
Saki Takamachi
2c8662d6f9
Fixed a bug in BcMath\Number::pow() and bcpow() when raising negative powers of 0. ( #16694 )
...
Closes #16694
Fixes #16236
2024-11-20 00:16:52 +09:00
Saki Takamachi
f464298c8e
Merge branch 'PHP-8.4'
...
* PHP-8.4:
Fixed a bug where size_t underflows (#16696 )
Added early return case when result is 0 (#16697 )
2024-11-05 08:43:58 +09:00
Saki Takamachi
fd1dff988e
Fixed a bug where size_t underflows ( #16696 )
...
fixes #16262
closes #16696
2024-11-05 08:41:09 +09:00
Saki Takamachi
2fe7719a44
Added early return case when result is 0 ( #16697 )
...
fixes #16265
closes #16697
2024-11-05 08:38:38 +09:00
DanielEScherzer
7a8b1f683b
Generated arginfo header files: use known strings for prop names when… ( #15751 )
...
Instead of allocating, using, and then releasing a zend_string for every
property name unconditionally, only do so when the minimum supported version of
PHP does not have that string in its known strings (ZEND_KNOWN_STRINGS). If the
string is already known, just use the known version directly. This is already
done for some non-generated class registrations, e.g. in
`zend_enum_register_props()`.
2024-09-30 13:22:34 +02:00
Christoph M. Becker
825509ee9e
Drop superfluous LONG_MAX/LONG_MIN fallback definitions (GH-15667)
...
Both macros are supposed to be defined in limits.h (C99) and as such it
is superfluous to provide fallback definitions. Even worse, because
these fallback definitions didn't cater to LP64, ILP64 and SILP64 data
models (and maybe some rather uncommon ones), but just assumed ILP32,
they are confusing.
2024-09-27 17:34:54 +02:00
Saki Takamachi
c5b258fedc
Fix GH-15968: Avoid converting objects to strings in operator calculations. ( #16021 )
2024-09-24 22:33:36 +09:00
Gina Peter Banyard
585cf9c156
ext/bcmath: null should not be supported for operator overloading & fix some comparison issues ( #15875 )
2024-09-23 11:49:33 +01:00
Saki Takamachi
f6db576c31
[RFC] ext/bcmath: Added bcdivmod ( #15740 )
...
RFC: https://wiki.php.net/rfc/add_bcdivmod_to_bcmath
Added bcdivmod() function and added divmod() method to BcMath\Number class.
2024-09-23 06:43:11 +09:00
Saki Takamachi
05cb27a8f9
ext/bcmath: Check for scale overflow ( #15741 )
2024-09-22 06:59:06 +09:00
Jorg Adam Sowa
306dedcf5e
ext/bcmath: bcpow() performance improvement ( #15790 )
...
* Added function for squaring to improve performance of power calculation
* Aligned backslashes
* Removed unnecessary comments
* Extracted common part of multiplication and square functions
* Added comment to bc_fast_square
* Improved wording of bc_mul_finish_from_vector
* Reused new function name
* Replaced macro with function
2024-09-17 22:16:26 +02:00
Niels Dossche
ac0931d37a
Reuse bcmath_check_scale()
2024-09-07 12:26:59 +02:00
Niels Dossche
2e88916b58
Move bcmath_check_scale()
2024-09-07 12:26:59 +02:00
Niels Dossche
f1b4e1276c
Simplify bcmath_check_scale()
...
The scale is default-initialized to 0, so we can simplify the code a
bit.
2024-09-07 12:26:59 +02:00
Saki Takamachi
fad899e566
[RFC] Support object types in BCMath ( #13741 )
...
Added BcMath\Number class. It is an immutable object, has methods that are
equivalent to existing BCMath calculation functions, and can also be calculated
using operators.
The existing BCMath function returned a string for each calculation, but this
class returns an object.
RFC: https://wiki.php.net/rfc/support_object_type_in_bcmath ,
https://wiki.php.net/rfc/fix_up_bcmath_number_class
---------
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com >
2024-09-04 11:12:51 +09:00
Saki Takamachi
a27878cff3
Fixed LONG_MAX in BCMath ext ( #15663 )
2024-08-31 01:07:33 +09:00