lua-users home
lua-l archive

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


On 7 December 2010 05:16, Ralph Hempel <rhempel@bmts.com> wrote:
> Sorry for the late reply, but I have one question on the bit32
> library:
>
> The library provides the following shift operators:
>
> arshift - arithmetic shift (+right -left )
> lrotate - rotate left      (+left  -right)
> lshift  - shift left       (+left  -right)
> rrotate - rotate right     (+right -left)
> rshift  - shift right      (+right -left)
>
> It seems to me that really only three operators needed, and the
> implied direction of the shift value should be consistent across
> all three, like this:
>
> ashift - arithmetic shift (+right -left )
> rotate - rotate           (+right -left)
> lshift - logical shift    (+right -left)
>
>

I seem to recall that idea being proposed by the devs and it going
down very badly. Luckily with Lua it’s trivial to alias arshift as
ashift.

> It's too bad that something as "simple" as a bit library gets this much attention :-)

I think the devs suspected the bit library would be this
controversial, and probably spent a while steeling themselves before
getting to work :-)

Vaughan