<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta http-equiv="Content-Style-Type" content="text/css" /><meta name="generator" content="pandoc" /><title></title><style type="text/css">code{white-space: pre;}</style></head><body><div class="gmail_quote">On November 29, 2016 3:01:57 AM GMT+02:00, "Filip Roséen" <filip@atch.se> wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


  
  
  
  
  


<p>Hi Pierre,</p>
<p>On 2016-11-28 23:56, vlc-devel wrote:</p>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code> From: Pierre Ynard <linkfanel@yahoo.fr>
 To: vlc-devel@videolan.org</code></pre>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code> 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.</code></pre>
</blockquote>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code>     #if LUA_MININTEGER > INT64_MIN || LUA_MAXINTEGER < INT64_MAX
         if( val.i_int < LUA_MININTEGER || val.i_int > LUA_MAXINTEGER )</code></pre>
</blockquote>
<pre><code> 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.</code></pre>
</blockquote>
<p>The above is not entirely true, but you are correct in that it is not guaranteed to work for <em>VLC</em> (since we do not require <code>lua >= 5.3</code>).</p>
<p>Lua <code>5.3</code> defines <code>LUA_MININTEGER</code> and <code>LUA_MAXINTEGER</code>, and I honestly assumed that it had been around longer than <code>5.3</code> (but this, as you imply, is not the case).</p>
<ul>
<li>https://www.lua.org/manual/5.3/manual.html#pdf-LUA_MININTEGER</li>
<li>https://www.lua.org/manual/5.3/manual.html#pdf-LUA_MAXINTEGER</li>
</ul>
<p>There are <em>hacks</em> (with heavy emphasize on the usage of “hack”) that would allow for a middle-ground for what you and I want even for lua <code>5.1</code>: though I will refrain from replying until I have explored some other alternatives.</p>
<p>I will try to come up with something that is not <em>too</em> bad during the next few hours.</p>
<p>Best Regards,<br />
Filip Roséen</p>


<p style="margin-top: 2.5em; margin-bottom: 1em; border-bottom: 1px solid #000"></p><pre class="k9mail"><hr /><br />vlc-devel mailing list<br />To unsubscribe or modify your subscription options:<br /><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a></pre></blockquote></div><br clear="all">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.<br>
-- <br>
Rémi Denis-Courmont</body></html>