[php-src] PR #21913: Use alignment builtins for ZEND_MM_ALIGNED macros
| From: | tobil4sk | Date: | Thu, 30 Apr 2026 01:50:21 +0000 |
| Subject: | [php-src] PR #21913: Use alignment builtins for ZEND_MM_ALIGNED macros | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-35952@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/21913
Author: tobil4sk
Where available, these provide a more descriptive way of aligning pointers than direct bitwise
manipulation. The additional abstraction they provide also makes them more compatible with platforms
like [CHERI](https://en.wikipedia.org/wiki/Capability_Hardware_Enhanced_RISC_Instructions).
Also, the non-builtin
ZEND_MM_ALIGNED_BASE implementation now casts to
uintptr_t instead of size_t, since the returned value tends to be used as
a pointer, not a size. This makes intent clearer and also improves compatibility.
These patches are from a port of PHP to pure-capability CHERI (where pointers are wider than
size_t and narrowing invalidates the pointer). Using these builtins improves
compatibility generally and they seem preferable due to the abstraction. I thought I would send this
patch upstream in case it is of interest.