php-src/ext/random/tests
Tim Düsterhus 0cfc45b667
random: Use branchless implementation for mask generation in Randomizer::getBytesFromString() (#10522)
* random: Add `max_offset` local to Randomizer::getBytesFromString()

* random: Use branchless implementation for mask generation in Randomizer::getBytesFromString()

This was benchmarked against clzl with a standalone script with random inputs
and is slightly faster. clzl requires an additional branch to handle the
source_length = 1 / max_offset = 0 case.

* Improve comment for masking in Randomizer::getBytesFromString()
2023-02-08 09:36:12 +01:00
..
01_functions Fix pre-PHP 8.2 compatibility for php_mt_rand_range() with MT_RAND_PHP (#9839) 2022-10-28 16:52:43 +02:00
02_engine random: Validate that the arrays do not contain extra elements when unserializing (#9458) 2022-09-05 17:33:36 +02:00
03_randomizer random: Use branchless implementation for mask generation in Randomizer::getBytesFromString() (#10522) 2023-02-08 09:36:12 +01:00
engines.inc random: Fix off-by-one in fast path selection of Randomizer::getBytesFromString() (#10449) 2023-01-26 23:28:34 +01:00