Thanks. So many options, so little time.|
> Date: Thu, 31 Jan 2008 15:17:23 -0500
> From: email@example.com
> To: firstname.lastname@example.org
> Subject: Re: Larger data types...
> On Thursday, January 31, 2008 Al Pfalzgraf wrote:
> > I am applying Lua to a DeviceNet protocol project. DeviceNet has a
> > very large set of data types including some 64 bit types. Within C
> > code they can be declared using __int64 or unsigned __int64.
> > lua_pushnumber results in warnings or errors with these.
> > warning C4244: 'function' :conversion from '__int64 ' to 'double ', possible loss of data
> > warning C4244: 'function' : conversion from 'unsigned __int64 ' to 'double ', possible loss of data
> > error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64
> > Is there an extension library that addresses this, or am I about to create one?
> You can do it without an extension by abusing the string type: since
> strings are really just blobs of bits, you can make 8 byte binary
> strings for your large numbers, e.g., with lua_pushlstring(), and get
> them back with lua_tolstring().
> If you find this distasteful :-) ... you can still get by without an
> extension by storing the large numbers as a table or tuple (search
> http://lua-users.org/wiki/FindPage for "tuple").
> A pure Lua approach using tables:
> There are other add-on approaches...
> Lnum, http://luaforge.net/projects/lnum/ modifies the Lua core to have
> large numbers.
> And libraries...
> Bignum, http://luaforge.net/projects/bignum/ adds support for "big
> integers based in the BIGNUM of the OpenSSL C package."
> LGMP, http://members.chello.nl/~w.couwenberg/lgmp.htm is a available.
> There is also a Lua binding for MAPM
> Doug Currie
> Londonderry, NH, USA
Need to know the score, the latest news, or you need your Hotmail®-get your "fix". Check it out.