You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/dev/ffi.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,8 @@ In the case of `@[extern]` all *irrelevant* types are removed first; see next se
34
34
35
35
### Translating Types from Lean to C
36
36
37
-
* The integer types `UInt8`, ..., `UInt64`, `USize` are represented by the C types `uint8_t`, ..., `uint64_t`, `size_t`, respectively
37
+
* The integer types `UInt8`, ..., `UInt64`, `USize`, `Int8`, ..., `Int64`, `ISize` are represented by
38
+
the C types `uint8_t`, ..., `uint64_t`, `size_t`, `int8_t`, ..., `int64_t`, `ptrdiff_t` respectively
38
39
* `Char` is represented by `uint32_t`
39
40
* `Float` is represented by `double`
40
41
* An *enum* inductive type of at least 2 and at most 2^32 constructors, each of which with no parameters, is represented by the first type of `uint8_t`, `uint16_t`, `uint32_t` that is sufficient to represent all constructor indices.
@@ -49,7 +50,6 @@ In the case of `@[extern]` all *irrelevant* types are removed first; see next se
49
50
is represented by the representation of that parameter's type.
50
51
51
52
For example, `{ x : α // p }`, the `Subtype` structure of a value of type `α` and an irrelevant proof, is represented by the representation of `α`.
52
-
Similarly, the signed integer types `Int8`, ..., `Int64`, `ISize` are also represented by the unsigned C types `uint8_t`, ..., `uint64_t`, `size_t`, respectively, because they have a trivial structure.
53
53
* `Nat` and `Int` are represented by `lean_object *`.
54
54
Their runtime values is either a pointer to an opaque bignum object or, if the lowest bit of the "pointer" is 1 (`lean_is_scalar`), an encoded unboxed natural number or integer (`lean_box`/`lean_unbox`).
55
55
* A universe `Sort u`, type constructor `... → Sort u`, `Void α` or proposition `p : Prop` is *irrelevant* and is either statically erased (see above) or represented as a `lean_object *` with the runtime value `lean_box(0)`
0 commit comments