summaryrefslogtreecommitdiff
path: root/doc/ext_ffi_semantics.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/ext_ffi_semantics.html')
-rw-r--r--doc/ext_ffi_semantics.html40
1 files changed, 25 insertions, 15 deletions
diff --git a/doc/ext_ffi_semantics.html b/doc/ext_ffi_semantics.html
index b2b3af30..69dfc2ca 100644
--- a/doc/ext_ffi_semantics.html
+++ b/doc/ext_ffi_semantics.html
@@ -39,8 +39,6 @@ td.convop { font-style: italic; width: 16em; }
39</li><li> 39</li><li>
40<a href="ext_ffi_api.html">ffi.* API</a> 40<a href="ext_ffi_api.html">ffi.* API</a>
41</li><li> 41</li><li>
42<a href="ext_ffi_int64.html">64 bit Integers</a>
43</li><li>
44<a class="current" href="ext_ffi_semantics.html">FFI Semantics</a> 42<a class="current" href="ext_ffi_semantics.html">FFI Semantics</a>
45</li></ul> 43</li></ul>
46</li><li> 44</li><li>
@@ -653,7 +651,10 @@ parameters given by the function declaration. Arguments passed to the
653variable argument part of vararg C&nbsp;function use 651variable argument part of vararg C&nbsp;function use
654<a href="#convert_vararg">special conversion rules</a>. This 652<a href="#convert_vararg">special conversion rules</a>. This
655C&nbsp;function is called and the return value (if any) is 653C&nbsp;function is called and the return value (if any) is
656<a href="#convert_tolua">converted to a Lua object</a>.</li> 654<a href="#convert_tolua">converted to a Lua object</a>.<br>
655On Windows/x86 systems, <tt>stdcall</tt> functions are automatically
656detected and a function declared as <tt>cdecl</tt> (the default) is
657silently fixed up after the first call.</li>
657 658
658</ul> 659</ul>
659 660
@@ -672,15 +673,24 @@ can be subtracted. The result is the difference between their
672addresses, divided by the element size in bytes. An error is raised if 673addresses, divided by the element size in bytes. An error is raised if
673the element size is undefined or zero.</li> 674the element size is undefined or zero.</li>
674 675
675<li><a href="ext_ffi_int64.html">64&nbsp;bit integer arithmetic</a>: 676<li><b>64&nbsp;bit integer arithmetic</b>: the standard arithmetic
676the standard arithmetic operators 677operators (<tt>+&nbsp;-&nbsp;*&nbsp;/&nbsp;%&nbsp;^</tt> and unary
677(<tt>+&nbsp;-&nbsp;*&nbsp;/&nbsp;%&nbsp;^</tt> and unary <tt>-</tt>) 678minus) can be applied to two cdata numbers, or a cdata number and a
678can be applied to two cdata numbers, or a cdata number and a Lua 679Lua number. If one of them is an <tt>uint64_t</tt>, the other side is
679number. If one of them is an <tt>uint64_t</tt>, the other side is
680converted to an <tt>uint64_t</tt> and an unsigned arithmetic operation 680converted to an <tt>uint64_t</tt> and an unsigned arithmetic operation
681is performed. Otherwise both sides are converted to an 681is performed. Otherwise both sides are converted to an
682<tt>int64_t</tt> and a signed arithmetic operation is performed. The 682<tt>int64_t</tt> and a signed arithmetic operation is performed. The
683result is a boxed 64&nbsp;bit cdata object.</li> 683result is a boxed 64&nbsp;bit cdata object.<br>
684
685These rules ensure that 64&nbsp;bit integers are "sticky". Any
686expression involving at least one 64&nbsp;bit integer operand results
687in another one. The undefined cases for the division, modulo and power
688operators return <tt>2LL&nbsp;^&nbsp;63</tt> or
689<tt>2ULL&nbsp;^&nbsp;63</tt>.<br>
690
691You'll have to explicitly convert a 64&nbsp;bit integer to a Lua
692number (e.g. for regular floating-point calculations) with
693<tt>tonumber()</tt>. But note this may incur a precision loss.</li>
684 694
685</ul> 695</ul>
686 696
@@ -692,12 +702,12 @@ can be compared. The result is the same as an unsigned comparison of
692their addresses. <tt>nil</tt> is treated like a <tt>NULL</tt> pointer, 702their addresses. <tt>nil</tt> is treated like a <tt>NULL</tt> pointer,
693which is compatible with any other pointer type.</li> 703which is compatible with any other pointer type.</li>
694 704
695<li><a href="ext_ffi_int64.html">64&nbsp;bit integer comparison</a>: 705<li><b>64&nbsp;bit integer comparison</b>: two cdata numbers, or a
696two cdata numbers, or a cdata number and a Lua number can be compared 706cdata number and a Lua number can be compared with each other. If one
697with each other. If one of them is an <tt>uint64_t</tt>, the other 707of them is an <tt>uint64_t</tt>, the other side is converted to an
698side is converted to an <tt>uint64_t</tt> and an unsigned comparison 708<tt>uint64_t</tt> and an unsigned comparison is performed. Otherwise
699is performed. Otherwise both sides are converted to an 709both sides are converted to an <tt>int64_t</tt> and a signed
700<tt>int64_t</tt> and a signed comparison is performed.</li> 710comparison is performed.</li>
701 711
702</ul> 712</ul>
703 713