lua-users home
lua-l archive

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


In message <BAY23-F2471D75E73110CF0DF8999A1860@phx.gbl> you wrote:

> The latest Lua implementation does not seem to support bitwise
> operators. > Several patches exist on the web, some as an extension
> module (bit.band....) > and lua-users seems to have an old
> source-patch for bitwise operator > support.
> 
> 1. Is there any plan to add support for bitwise operator in the
>    generic Lua version?
> 2. Where can one find the latest patch?
> 3. This seems like a very basic and popular language feature,
>    what are the reasons for not adding it to the core language until
>    now?

To answer 3, Mike, the reasons are that Lua is such a flexible
package that the type of number used is very much up to the
individual implementor. For example, my OS is specific to the
ARM, and most users of it do not have on-processor floating point
operations provided. That is why the RISC OS distribution, RiscLua
(http://www.wra1th.plus.com/lua/) uses 32 bit integers for the
Lua_Number type. In this case extra operators &,|,^^,~,<<,>> are
provided, extending the standard Lua VM. You can download the
sources from my site, if you want to see the details. Look
for the stuff that is #ifdefined by GCW_BIT.

-- 
Gavin Wraith (gavin@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/