I'm not sure if this is often necessary, but sometimes it may be nice to
have.

Actually, this is "logical right shift" operation (>> is "arithmetic right
shift").
LSHR is a well recognizable name, used in assemblers.
Use T_LSHR instead of T_SHRZF.

Thanks. Dmitry.


On Tue, Feb 3, 2015 at 4:20 PM, Leigh <lei...@gmail.com> wrote:

> Hi list,
>
> How do we feel about a zero-fill right shift operator?
>
> PHPs current right shift operator preserves signage, but this is not
> always desirable.
>
> I propose the same syntax as JavaScript for this: >>>
>
> php -r 'var_dump(-256 >> 8);'
> int(-1)
>
> php -r 'var_dump(-256 >>> 8);'
> int(16777215)
>
> This will introduce a T_SHRZF token and corresponding opcode. Targeting
> PHP 7.
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Reply via email to