|
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