[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: why are there 2 cast operations (in 5.1src)?
- From: roberto@... (Roberto Ierusalimschy)
- Date: Sun, 20 May 2007 10:14:16 -0300
> last night i read the 5.1src and found a strange code in ltable.c, please
> note the lines i marked RED: there are 2 cast for "k" and "n", first cast
> "n" from lua_Number to int and result is saved in "k", but soon it then cast
> "k" back to lua_Number to adopt to the function luai_numeq as its first
> argument. i don't known why it's neccesary:(
To check whether that lua_Number fits in an integer. luai_numeq is
a macro that expands likes this:
if (cast_num(k) == nvalue(key)) /* index is int? */
-- Roberto