lua-users home
lua-l archive

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


>>>Maybe for this trick, luaconf.h can test what LUA_NUMBER really is and
>>>use a 'float'-trick or a 'double'-trick accordingly?
>>
>>
>> The C preprocessor does not do that kind of tests...
>>
>> -- Roberto
>>
>It can do that kinda test, it can check if LUA_NUMBER is defined to
>be double or float   [I think].

I think maybe it can't, I wasn't thinking about this when I proposed it. ;)
So how about something like this:

(at top of luaconfig.h)

//#define	LUA_USE_FLOAT
#define	LUA_USE_DOUBLE

...

#if !defined(LUA_ANSI) && !defined(__SSE2__) && \
    (defined(__i386) || defined (_M_IX86)) && defined(LUA_USE_DOUBLE)

..

#ifdef LUA_USE_FLOAT
#define LUA_NUMBER	float
#define LUAI_UACNUMBER	float
#else
#define LUA_NUMBER	double
#define LUAI_UACNUMBER	double
#endif

etcetera.

This way you only have to change something at one place to switch between
float-s and double-s.

Any good?

	Hugo