lua-users home
lua-l archive

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

2014-03-25 18:20 GMT+02:00 Paul Baker <>:

> Regarding the new bitwise operators, the Reference Manual states "Both
> right and left shifts fill with zeros the vacant bits". Given that
> "Lua 5.3 has integers but not unsigned integers" [1], it seems strange
> that the >> operator is unsigned rather than signed. Is there a reason
> for this? Personally, I think it would be useful for Lua to support
> both types of right shift - perhaps using the same syntax as
> JavaScript: >> and >>> ?

Don't agree.

I can see the point of arithmetic shift in C, where it could be useful
when programming multiprecision arithmetic — but C does not have
it. Its inclusion in the bit32 library always felt to me like a loving
preservation of a quirk of some early computer (IBM 360 springs to