diff options
Diffstat (limited to 'doc/ext_ffi_semantics.html')
-rw-r--r-- | doc/ext_ffi_semantics.html | 40 |
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 | |||
653 | variable argument part of vararg C function use | 651 | variable argument part of vararg C function use |
654 | <a href="#convert_vararg">special conversion rules</a>. This | 652 | <a href="#convert_vararg">special conversion rules</a>. This |
655 | C function is called and the return value (if any) is | 653 | C 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> |
655 | On Windows/x86 systems, <tt>stdcall</tt> functions are automatically | ||
656 | detected and a function declared as <tt>cdecl</tt> (the default) is | ||
657 | silently 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 | |||
672 | addresses, divided by the element size in bytes. An error is raised if | 673 | addresses, divided by the element size in bytes. An error is raised if |
673 | the element size is undefined or zero.</li> | 674 | the element size is undefined or zero.</li> |
674 | 675 | ||
675 | <li><a href="ext_ffi_int64.html">64 bit integer arithmetic</a>: | 676 | <li><b>64 bit integer arithmetic</b>: the standard arithmetic |
676 | the standard arithmetic operators | 677 | operators (<tt>+ - * / % ^</tt> and unary |
677 | (<tt>+ - * / % ^</tt> and unary <tt>-</tt>) | 678 | minus) can be applied to two cdata numbers, or a cdata number and a |
678 | can be applied to two cdata numbers, or a cdata number and a Lua | 679 | Lua number. If one of them is an <tt>uint64_t</tt>, the other side is |
679 | number. If one of them is an <tt>uint64_t</tt>, the other side is | ||
680 | converted to an <tt>uint64_t</tt> and an unsigned arithmetic operation | 680 | converted to an <tt>uint64_t</tt> and an unsigned arithmetic operation |
681 | is performed. Otherwise both sides are converted to an | 681 | is 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 |
683 | result is a boxed 64 bit cdata object.</li> | 683 | result is a boxed 64 bit cdata object.<br> |
684 | |||
685 | These rules ensure that 64 bit integers are "sticky". Any | ||
686 | expression involving at least one 64 bit integer operand results | ||
687 | in another one. The undefined cases for the division, modulo and power | ||
688 | operators return <tt>2LL ^ 63</tt> or | ||
689 | <tt>2ULL ^ 63</tt>.<br> | ||
690 | |||
691 | You'll have to explicitly convert a 64 bit integer to a Lua | ||
692 | number (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 | |||
692 | their addresses. <tt>nil</tt> is treated like a <tt>NULL</tt> pointer, | 702 | their addresses. <tt>nil</tt> is treated like a <tt>NULL</tt> pointer, |
693 | which is compatible with any other pointer type.</li> | 703 | which is compatible with any other pointer type.</li> |
694 | 704 | ||
695 | <li><a href="ext_ffi_int64.html">64 bit integer comparison</a>: | 705 | <li><b>64 bit integer comparison</b>: two cdata numbers, or a |
696 | two cdata numbers, or a cdata number and a Lua number can be compared | 706 | cdata number and a Lua number can be compared with each other. If one |
697 | with each other. If one of them is an <tt>uint64_t</tt>, the other | 707 | of them is an <tt>uint64_t</tt>, the other side is converted to an |
698 | side is converted to an <tt>uint64_t</tt> and an unsigned comparison | 708 | <tt>uint64_t</tt> and an unsigned comparison is performed. Otherwise |
699 | is performed. Otherwise both sides are converted to an | 709 | both sides are converted to an <tt>int64_t</tt> and a signed |
700 | <tt>int64_t</tt> and a signed comparison is performed.</li> | 710 | comparison is performed.</li> |
701 | 711 | ||
702 | </ul> | 712 | </ul> |
703 | 713 | ||