diff options
| author | Mike Pall <mike> | 2013-03-13 22:44:01 +0100 |
|---|---|---|
| committer | Mike Pall <mike> | 2013-03-14 06:03:18 +0100 |
| commit | a98aede37772797b4471e1a094452051edff5862 (patch) | |
| tree | 6e8c86838e359b899ffa0021bf3149087caa71da /doc | |
| parent | 3e8f5ac7186ecac63e17688b9ba6e72697143dbb (diff) | |
| download | luajit-a98aede37772797b4471e1a094452051edff5862.tar.gz luajit-a98aede37772797b4471e1a094452051edff5862.tar.bz2 luajit-a98aede37772797b4471e1a094452051edff5862.zip | |
FFI: Add 64 bit bitwise operations.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/ext_ffi_semantics.html | 17 | ||||
| -rw-r--r-- | doc/extensions.html | 3 |
2 files changed, 19 insertions, 1 deletions
diff --git a/doc/ext_ffi_semantics.html b/doc/ext_ffi_semantics.html index 03229012..15c9a6db 100644 --- a/doc/ext_ffi_semantics.html +++ b/doc/ext_ffi_semantics.html | |||
| @@ -730,6 +730,22 @@ You'll have to explicitly convert a 64 bit integer to a Lua | |||
| 730 | number (e.g. for regular floating-point calculations) with | 730 | number (e.g. for regular floating-point calculations) with |
| 731 | <tt>tonumber()</tt>. But note this may incur a precision loss.</li> | 731 | <tt>tonumber()</tt>. But note this may incur a precision loss.</li> |
| 732 | 732 | ||
| 733 | <li><b>64 bit bitwise operations</b>: the rules for 64 bit | ||
| 734 | arithmetic operators apply analogously.<br> | ||
| 735 | |||
| 736 | Unlike the other <tt>bit.*</tt> operations, <tt>bit.tobit()</tt> | ||
| 737 | converts a cdata number via <tt>int64_t</tt> to <tt>int32_t</tt> and | ||
| 738 | returns a Lua number.<br> | ||
| 739 | |||
| 740 | For <tt>bit.band()</tt>, <tt>bit.bor()</tt> and <tt>bit.bxor()</tt>, the | ||
| 741 | conversion to <tt>int64_t</tt> or <tt>uint64_t</tt> applies to | ||
| 742 | <em>all</em> arguments, if <em>any</em> argument is a cdata number.<br> | ||
| 743 | |||
| 744 | For all other operations, only the first argument is used to determine | ||
| 745 | the output type. This implies that a cdata number as a shift count for | ||
| 746 | shifts and rotates is accepted, but that alone does <em>not</em> cause | ||
| 747 | a cdata number output. | ||
| 748 | |||
| 733 | </ul> | 749 | </ul> |
| 734 | 750 | ||
| 735 | <h3 id="cdata_comp">Comparisons of cdata objects</h3> | 751 | <h3 id="cdata_comp">Comparisons of cdata objects</h3> |
| @@ -1222,7 +1238,6 @@ value.</li> | |||
| 1222 | Other missing features: | 1238 | Other missing features: |
| 1223 | </p> | 1239 | </p> |
| 1224 | <ul> | 1240 | <ul> |
| 1225 | <li>Bit operations for 64 bit types.</li> | ||
| 1226 | <li>Arithmetic for <tt>complex</tt> numbers.</li> | 1241 | <li>Arithmetic for <tt>complex</tt> numbers.</li> |
| 1227 | <li>Passing structs by value to vararg C functions.</li> | 1242 | <li>Passing structs by value to vararg C functions.</li> |
| 1228 | <li><a href="extensions.html#exceptions">C++ exception interoperability</a> | 1243 | <li><a href="extensions.html#exceptions">C++ exception interoperability</a> |
diff --git a/doc/extensions.html b/doc/extensions.html index 2bfcc76c..f288fbde 100644 --- a/doc/extensions.html +++ b/doc/extensions.html | |||
| @@ -113,6 +113,9 @@ bit.lshift bit.rshift bit.arshift bit.rol bit.ror bit.bswap | |||
| 113 | This module is a LuaJIT built-in — you don't need to download or | 113 | This module is a LuaJIT built-in — you don't need to download or |
| 114 | install Lua BitOp. The Lua BitOp site has full documentation for all | 114 | install Lua BitOp. The Lua BitOp site has full documentation for all |
| 115 | <a href="http://bitop.luajit.org/api.html"><span class="ext">»</span> Lua BitOp API functions</a>. | 115 | <a href="http://bitop.luajit.org/api.html"><span class="ext">»</span> Lua BitOp API functions</a>. |
| 116 | The FFI adds support for | ||
| 117 | <a href="ext_ffi_semantics.html#cdata_arith">64 bit bitwise operations<a>, | ||
| 118 | using the same API functions. | ||
| 116 | </p> | 119 | </p> |
| 117 | <p> | 120 | <p> |
| 118 | Please make sure to <tt>require</tt> the module before using any of | 121 | Please make sure to <tt>require</tt> the module before using any of |
