Why use "floating point byte" in NEWTABLE opcode?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Why use "floating point byte" in NEWTABLE opcode?

chuang
In the NEWTABLE opcode, the field B and C,which is the array and hash size of the table,respectively,use the so-called "floating point byte" with unsigned int.
I guess theĀ "floating point byte" can support more data range than the raw unsigned int, is it right?
Reply | Threaded
Open this post in threaded view
|

Re: Why use "floating point byte" in NEWTABLE opcode?

Roberto Ierusalimschy
> In the NEWTABLE opcode, the field B and C,which is the array and hash size
> of the table,respectively,use the so-called "floating point byte" with
> unsigned int.
> I guess the "floating point byte" can support more data range than the raw
> unsigned int, is it right?

It can support a range larger than unsigned int, although the
functions that Lua use to support it cannot. Its purpose
is to pack such range into a single byte.

-- Roberto

Reply | Threaded
Open this post in threaded view
|

Re: Why use "floating point byte" in NEWTABLE opcode?

chuang
Cool,Thanks!


On Thu, May 30, 2013 at 5:41 PM, Roberto Ierusalimschy <[hidden email]> wrote:
> In the NEWTABLE opcode, the field B and C,which is the array and hash size
> of the table,respectively,use the so-called "floating point byte" with
> unsigned int.
> I guess the "floating point byte" can support more data range than the raw
> unsigned int, is it right?

It can support a range larger than unsigned int, although the
functions that Lua use to support it cannot. Its purpose
is to pack such range into a single byte.

-- Roberto