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.html35
1 files changed, 27 insertions, 8 deletions
diff --git a/doc/ext_ffi_semantics.html b/doc/ext_ffi_semantics.html
index 381a2010..5ba82a1e 100644
--- a/doc/ext_ffi_semantics.html
+++ b/doc/ext_ffi_semantics.html
@@ -1,8 +1,8 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 1<!DOCTYPE html>
2<html> 2<html>
3<head> 3<head>
4<title>FFI Semantics</title> 4<title>FFI Semantics</title>
5<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 5<meta charset="utf-8">
6<meta name="Copyright" content="Copyright (C) 2005-2023"> 6<meta name="Copyright" content="Copyright (C) 2005-2023">
7<meta name="Language" content="en"> 7<meta name="Language" content="en">
8<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen"> 8<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
@@ -42,9 +42,13 @@ td.convop { font-style: italic; width: 40%; }
42<a class="current" href="ext_ffi_semantics.html">FFI Semantics</a> 42<a class="current" href="ext_ffi_semantics.html">FFI Semantics</a>
43</li></ul> 43</li></ul>
44</li><li> 44</li><li>
45<a href="ext_buffer.html">String Buffers</a>
46</li><li>
45<a href="ext_jit.html">jit.* Library</a> 47<a href="ext_jit.html">jit.* Library</a>
46</li><li> 48</li><li>
47<a href="ext_c_api.html">Lua/C API</a> 49<a href="ext_c_api.html">Lua/C API</a>
50</li><li>
51<a href="ext_profiler.html">Profiler</a>
48</li></ul> 52</li></ul>
49</li><li> 53</li><li>
50<a href="https://luajit.org/status.html">Status <span class="ext">&raquo;</span></a> 54<a href="https://luajit.org/status.html">Status <span class="ext">&raquo;</span></a>
@@ -175,6 +179,8 @@ a <tt>typedef</tt>, except re-declarations will be ignored):
175<tt>uint16_t</tt>, <tt>uint32_t</tt>, <tt>uint64_t</tt>, 179<tt>uint16_t</tt>, <tt>uint32_t</tt>, <tt>uint64_t</tt>,
176<tt>intptr_t</tt>, <tt>uintptr_t</tt>.</li> 180<tt>intptr_t</tt>, <tt>uintptr_t</tt>.</li>
177 181
182<li>From <tt>&lt;unistd.h&gt;</tt> (POSIX): <tt>ssize_t</tt>.</li>
183
178</ul> 184</ul>
179<p> 185<p>
180You're encouraged to use these types in preference to 186You're encouraged to use these types in preference to
@@ -722,6 +728,22 @@ You'll have to explicitly convert a 64&nbsp;bit integer to a Lua
722number (e.g. for regular floating-point calculations) with 728number (e.g. for regular floating-point calculations) with
723<tt>tonumber()</tt>. But note this may incur a precision loss.</li> 729<tt>tonumber()</tt>. But note this may incur a precision loss.</li>
724 730
731<li><b>64&nbsp;bit bitwise operations</b>: the rules for 64&nbsp;bit
732arithmetic operators apply analogously.<br>
733
734Unlike the other <tt>bit.*</tt> operations, <tt>bit.tobit()</tt>
735converts a cdata number via <tt>int64_t</tt> to <tt>int32_t</tt> and
736returns a Lua number.<br>
737
738For <tt>bit.band()</tt>, <tt>bit.bor()</tt> and <tt>bit.bxor()</tt>, the
739conversion to <tt>int64_t</tt> or <tt>uint64_t</tt> applies to
740<em>all</em> arguments, if <em>any</em> argument is a cdata number.<br>
741
742For all other operations, only the first argument is used to determine
743the output type. This implies that a cdata number as a shift count for
744shifts and rotates is accepted, but that alone does <em>not</em> cause
745a cdata number output.
746
725</ul> 747</ul>
726 748
727<h3 id="cdata_comp">Comparisons of cdata objects</h3> 749<h3 id="cdata_comp">Comparisons of cdata objects</h3>
@@ -1193,14 +1215,12 @@ The following operations are currently not compiled and may exhibit
1193suboptimal performance, especially when used in inner loops: 1215suboptimal performance, especially when used in inner loops:
1194</p> 1216</p>
1195<ul> 1217<ul>
1196<li>Bitfield accesses and initializations.</li>
1197<li>Vector operations.</li> 1218<li>Vector operations.</li>
1198<li>Table initializers.</li> 1219<li>Table initializers.</li>
1199<li>Initialization of nested <tt>struct</tt>/<tt>union</tt> types.</li> 1220<li>Initialization of nested <tt>struct</tt>/<tt>union</tt> types.</li>
1200<li>Allocations of variable-length arrays or structs.</li> 1221<li>Non-default initialization of VLA/VLS or large C&nbsp;types
1201<li>Allocations of C&nbsp;types with a size &gt; 128&nbsp;bytes or an 1222(&gt; 128&nbsp;bytes or &gt; 16 array elements).</li>
1202alignment &gt; 8&nbsp;bytes.</li> 1223<li>Bitfield initializations.</li>
1203<li>Conversions from lightuserdata to <tt>void&nbsp;*</tt>.</li>
1204<li>Pointer differences for element sizes that are not a power of 1224<li>Pointer differences for element sizes that are not a power of
1205two.</li> 1225two.</li>
1206<li>Calls to C&nbsp;functions with aggregates passed or returned by 1226<li>Calls to C&nbsp;functions with aggregates passed or returned by
@@ -1216,7 +1236,6 @@ value.</li>
1216Other missing features: 1236Other missing features:
1217</p> 1237</p>
1218<ul> 1238<ul>
1219<li>Bit operations for 64&nbsp;bit types.</li>
1220<li>Arithmetic for <tt>complex</tt> numbers.</li> 1239<li>Arithmetic for <tt>complex</tt> numbers.</li>
1221<li>Passing structs by value to vararg C&nbsp;functions.</li> 1240<li>Passing structs by value to vararg C&nbsp;functions.</li>
1222<li><a href="extensions.html#exceptions">C++ exception interoperability</a> 1241<li><a href="extensions.html#exceptions">C++ exception interoperability</a>