Hi!

> This is intended x86 specific optimization. The behavior of SHR is
> documented.
>
> See https://c9x.me/x86/html/file_module_x86_id_285.html
>
> "The count is masked to 5 bits, which limits the count range to 0 to 31"
> on 32-bit systems.

I see. But I wonder whether the compiler will always compile it as SHR,
is it guarnateed? Looking at optimization behavior for clang, for me
ZEND_BIT_TEST( bits, 65 ) - where bits is an array of 0xFF - produces 1
under -O0 but 0 under -O1 (I guess it figures out it's a constant and
optimizes the shift away). So I wonder whether this construct isn't
dangerous...

-- 
Stas Malyshev
smalys...@wikimedia.org

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to