lua-users home
lua-l archive

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


So why not thinking of adding a type long long int to lua 5.2 besides
doubles? I know that so far adding a new type was disregarded because of
size increase of code. For me Lua interpretor size isn't critical... But
I guess that properly used conditional compilations to support either 1
NUMBER type (double by default without bitwise operator) or 2 two number
types (double like at first and then int with optional bitwise
operators). Then it is true it may be difficult to agree on type
inference semantic.

But I really need both: I'm doing statistics (ie double preferred) on
address manipulations (ie int with bitwise operation). And I'm not very
willing to create a user type for addresses because I can't have easy
operator notations... 

Suggested bit operators:
a|b	or
16:F | 16:F3 = 16:FF
a&b	and
16:F & 16:F3 = 16:3
a^b	xor
16:F ^ 16:F3 = 16:FC
A >> s	right shift (always with 0 complement ?)
16:F >> 3 = 16:1
A <<0< s	left shift with 0 complement
16:F <<0< 3 = 16:78
A <<1< s	left with 1 complement
16:F <<1< 3 = 16:7F
#b	num bit == 1
#16:F = 4
~v

-----Original Message-----
From: lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of Erik Hougaard
Sent: Monday, June 19, 2006 10:51 AM
To: Lua list
Subject: Re: Bitwsie operators in Lua

mike krimerman wrote:
> 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?
Numbers are floats/doubles ;-)

/Erik