[vlc-devel] [PATCH] lua: work around 32-bit integers limitation in vlc.var

Rémi Denis-Courmont remi at remlab.net
Tue Nov 29 08:30:48 CET 2016


On November 29, 2016 3:01:57 AM GMT+02:00, "Filip Roséen" <filip at atch.se> wrote:
>Hi Pierre,
>
>On 2016-11-28 23:56, vlc-devel wrote:
>
>> From: Pierre Ynard <linkfanel at yahoo.fr>
>> To: vlc-devel at videolan.org
>> 
>> > Using `sizeof` is not really what you want, you should compare the
>> > *max*/*min* value of the two types in order to properly check if
>the
>> > value will fit.
>> 
>> >     #if LUA_MININTEGER > INT64_MIN || LUA_MAXINTEGER < INT64_MAX
>> >         if( val.i_int < LUA_MININTEGER || val.i_int >
>LUA_MAXINTEGER )
>> 
>> Lua provides no such macro or anything workable. As I said it would
>have
>> to be added with autoconf, but in my opinion that's not worth it.
>
>The above is not entirely true, but you are correct in that it is not
>guaranteed to work for *VLC* (since we do not require  `lua >= 5.3`).
>
>Lua `5.3` defines `LUA_MININTEGER` and `LUA_MAXINTEGER`, and I
>honestly assumed that it had been around longer than `5.3` (but this,
>as you imply, is not the case).
>
> - https://www.lua.org/manual/5.3/manual.html#pdf-LUA_MININTEGER
> - https://www.lua.org/manual/5.3/manual.html#pdf-LUA_MAXINTEGER
>
>There are *hacks* (with heavy emphasize on the usage of "hack") that
>would allow for a middle-ground for what you and I want even for lua
>`5.1`: though I will refrain from replying until I have explored some
>other alternatives.
>
>I will try to come up with something that is not *too* bad during the
>next few hours.
>
>Best Regards,\
>Filip Roséen
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

I think using 64-bits integers in Lua would be simpler. Switching to 5.3 will break binary compatibility in any case, so that would be a good time.
-- 
Rémi Denis-Courmont
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20161129/95d7184e/attachment.html>


More information about the vlc-devel mailing list