[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua and numbers
- From: Gavin Wraith <gavin@...>
- Date: Thu, 06 Apr 2006 11:35:12 +0100
In message <1144309597.4434c75d4577d@webmail.dnainternet.net> you wrote:
> Just use the "integer patch" from Wiki power patch pages.
I am afraid you have either misunderstood what I wrote or not read
it carefully. I already use integers for Lua_number. What I need is two
numeric types in Lua, one for 32-bit integers and one for
32-bit floating point numbers. At the moment the sources use
only one sort of numeric type. In lua.h for example we have
#define LUA_TNIL 0
#define LUA_TBOOLEAN 1
#define LUA_TLIGHTUSERDATA 2
#define LUA_TNUMBER 3
#define LUA_TSTRING 4
#define LUA_TTABLE 5
#define LUA_TFUNCTION 6
#define LUA_TUSERDATA 7
#define LUA_TTHREAD 8
Would it be safe to add a line
#define LUA_TFLOAT 9
for the extra type, for example? Or would this clash with
const char *const luaT_typenames[] = {
"nil", "boolean", "userdata", "number",
"string", "table", "function", "userdata", "thread",
"proto", "upval"
};
in ltm.c, which suggests that codes 9 and 10 are already used?
Having two 32-bit numeric types would appear to require fairly
radical rewriting of the sources. And yet I do not think it an
unreasonable thing to want on an ARM machine.
--
Gavin Wraith (gavin@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/