lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 05/15/2017 03:31 AM, sur-behoffski wrote:
> This is a long message, so TL;DR:
>      * Be careful to distinguish between LOGICAL shift right and ARITHMETIC
>        shift right (assuming a twos-complement architecture).
>      * Some of these machine-level operations are not natively available in
>        "C89" (ANSI X3.159-1989) at the coder's level, although the
> compiler,
>        the OS, and quite a number of associated libraries are likely to use
>        them quite extensively internally.  My understanding is that they
> can
>        be emulated in Lua, although not as cheaply as directly executing
>        native machine code.

Good post!

I think it'll benefit from mentioning related Intel microprocessor

    operation | left | right
    shift     | SHL  | SHR
    .arithm   | SAL  | SAR
    rotate    | ROL  | ROR
    .via_carry| RCL  | RCR

-- Martin