# wasm: Implement optionals and ensure correct alignment · gitcafe/zig

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

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

Visibility: public

Requested revision: ec5220405b0218f892f6a1636ddd04d791017309

Requested commit: ec5220405b0218f892f6a1636ddd04d791017309

Commit: ec5220405b0218f892f6a1636ddd04d791017309

Tree: d69aa5d8c4e876a61da6335d79149e8278194dde

Author: Luuk de Gram

Committer: Luuk de Gram

## Message

```
wasm: Implement optionals and ensure correct alignment

Rather than writing the alignment in its natural form, wasm binaries encode the alignment of types as the exponent of a power of 2.
So rather than performing this encoding during AIR->MIR, we do this while emitting MIR->binary encoding.
This allows us to keep alignment logic to its natural form while doing calculations (Which is what we need during linking as well).

We also implement optionals and pointers to an optional.

```

## Parents

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

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