lua-users home
lua-l archive

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

> On 15 May 2017, at 11:20, Sean Conner <> wrote:
> It was thus said that the Great Oliver Kroth once stated:
>> the difference in unsigned and signed shifting exists only in 
>> right-shifts, where the sign bit, which is at the leftmost position, is 
>> either kept (signed) or filled with zero or carry bit (unsigned)
>> On left-shifts no two versions are needed.
>  That, I get.  What I'm replying to is Stefan Ginsberg's statement:
>> I don't consider shifting out bits the same thing as overflow, it is
>> another type of operation.
>  I don't---it's multiplication/division by 2 (in terms of overflow).
>  -spc

I didn't mean that bit shifts wouldn't correspond to multiplication or division by 2.

However in usage I think of them more as acting on the bits than the "number" itself.

We could be dealing with bit flags, encoded values, or other data where
the series of bits is not interpreted as a number.
For example, a Lua opcode.

From that perspective, I don't consider shifting out bits to be the same thing as overflow.
The usage is different, and shifting out (set) bits is most likely intended.

That is what I meant with "another type of operation".