[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: snapshot of Lua 4.1 (work)
- From: "John Belmonte" <jvb@...>
- Date: Thu, 10 May 2001 12:31:24 +0900
What I'm happy about most with this snapshot, more than any of the new
features, is the clean-up of the Lua number type. This will eliminate much
of the hacking I have to do every time a new version is released. I did
notice a dangling double however, in llimits.h:
union L_Umaxalign { double d; void *s; long l; };
should probably be:
union L_Umaxalign { lua_Number d; void *s; long l; };
However a similar issue, controlling what the implementation uses for a
"long", still needs some work. I noticed that many of the local variables
that used to be longs without a good reason are now ints, which helps to
reduce the problem. However I'd really like a single place where the
implementation's notion of a "long" is defined with a macro, and that macro
to be used consistently in the code. For example I use a macro LLNG, and so
the Instruction typedef would become:
typedef unsigned LLNG Instruction;
On my platform I need to replace all long's (64-bit) with int's (32-bit).
One reason is the memory savings, although this is mainly addressed by the
Instruction typedef that already exists. The other reason is that my
compiler generates inefficient code for 64-bit operations, especially
conversion between long integer and floating point.
It's not much work, here are the current long references:
include\lauxlib.h(62): #define luaL_check_long(L,n)
((long)luaL_check_number(L, n))
include\lauxlib.h(64): #define luaL_opt_long(L,n,d)
((long)luaL_opt_number(L, n,d))
src\llimits.h(49): typedef unsigned long lu_mem;
src\llimits.h(52): typedef long ls_nstr;
src\llimits.h(85): union L_Umaxalign { double d; void *s; long l; };
src\llimits.h(95): typedef unsigned long Instruction;
src\lundump.c(222): if ((long)f!=(long)tf)
src\lib\lbaselib.c(107): unsigned long n;
src\lib\liolib.c(378): long offset = luaL_opt_long(L, 3, 0);
src\lib\lstrlib.c(21): typedef long sint32;
With that I could finally remove an item from my Lua warts list ;)
Regards,
-John