Re: Bitwsie operators in Lua
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Bitwsie operators in Lua
- From: David Jones <drj@...>
- Date: 2006年6月19日 14:04:10 +0100
Roberto Ierusalimschy wrote:
Essentially any bitwise operation gets converted to a series of
arithmetical operations,
That is all we wanted for Lua. But "not" and shifts are easy. Can you
give a viable implementation for or/and?
Well, I was talking about specifying the meaning. As for an
implementation, choose the simple portable approach: convert the number
to your favourite, C, integer type, do the operation in that type, then
convert back to whatever type you've chosen for numbers. Sticking to
double (for numbers) and int (for integers) and doing this gives you a
portable 32-bit implementation. luaconf.h helps those who want more.
drj