# wasm: support and optimize for all packed unions · gitcafe/zig

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

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

Visibility: public

Requested revision: 3c72b4d25eb14bbdc03503c368a750b1ca1b7c28

Requested commit: 3c72b4d25eb14bbdc03503c368a750b1ca1b7c28

Commit: 3c72b4d25eb14bbdc03503c368a750b1ca1b7c28

Tree: 2caa5eccfc33ace3d70cca45d23b5996c58e90b6

Author: Luuk de Gram

Committer: Luuk de Gram

## Message

```
wasm: support and optimize for all packed unions

For packed unions where its abi size is less than or equal to 8 bytes
we store it directly and don't pass it by reference. This means that
when retrieving the field, we will perform shifts and bitcasts to ensure
the correct type is returned. For larger packed unions, we either allocate
a new stack value based on the field type when the field type is also passed
by reference, or load it directly into a local if it's not.

```

## Parents

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

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