[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Bitwsie operators in Lua
- From: David Jones <drj@...>
- Date: Mon, 19 Jun 2006 14:04:10 +0100
Roberto Ierusalimschy wrote:
Essentially any bitwise operation gets converted to a series of
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.