Skip to content

Commit 0e30f3a

Browse files
committed
docs(#495): add sizeof docs
1 parent 1141ec7 commit 0e30f3a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

WYBE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2442,6 +2442,13 @@ converting its type from *type1* to *type2*, without changing the
24422442
representation. This just allows getting around LLVM strong typing; it does not
24432443
actually require any instructions.
24442444
2445+
- `foreign lpvm sizeof(`*arg:type*, `?`*size:int_type*`)` Get the size of the *type* of
2446+
the first argument in bytes. To get the size in bits, specify the `bits` modifier.
2447+
The size of a type is the size of it's largest constructor (at most a machine word), or the size of its' representation.
2448+
The first argument can be anything except for an outwards-flowing variable.
2449+
The type of the second argument, *int_type*, can have any integer represented type.
2450+
This instruction is resolved statically, with _no_ runtime cost.
2451+
24452452
24462453
#### Handling impurity
24472454

0 commit comments

Comments
 (0)