[vlc-devel] [PATCH] lua: work around 32-bit integers limitation in vlc.var
Filip Roséen
filip at atch.se
Tue Nov 29 02:01:57 CET 2016
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20161129/adf9ab8e/attachment.html>
More information about the vlc-devel
mailing list