# wasm: Implement \(and fix\) most optional instructions · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/c519d9c80e5b207a84b9bd414727bd41cb4fadfa)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: c519d9c80e5b207a84b9bd414727bd41cb4fadfa

Requested commit: c519d9c80e5b207a84b9bd414727bd41cb4fadfa

Commit: c519d9c80e5b207a84b9bd414727bd41cb4fadfa

Tree: fb72dfc603307552b309585246b1eb14e566bac6

Author: Luuk de Gram

Committer: Luuk de Gram

## Message

```
wasm: Implement (and fix) most optional instructions

Previously we were performing the wrapping and unwrapping operations incorrectly.
We now correctly create the type and set its values.
Besides this, we also set the null-byte to the incorrect value, which meant we were
doing the opposite action of a is_null check. This is now fixed as well.

While implementing this, I found a small bug in the wrapErrUnionPayload where we
would load a pointer value and save that, rather than store the pointer with the error.
This is now fixed as well, by copying the entire operand into the payload of the error union.

```

## Parents

- [5c228765f1094d30e64d13c0077c67b2867ecd6a](https://git.cafe/gitcafe/zig/commit/5c228765f1094d30e64d13c0077c67b2867ecd6a?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/c519d9c80e5b207a84b9bd414727bd41cb4fadfa?format=markdown)
