# wasm: Use 'select' instruction for max/min · gitcafe/zig

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

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

Visibility: public

Requested revision: ac873367b9d68e1d7b4cf4e5efbe179960dc7557

Requested commit: ac873367b9d68e1d7b4cf4e5efbe179960dc7557

Commit: ac873367b9d68e1d7b4cf4e5efbe179960dc7557

Tree: 97476eca40fa2619491c54c1484b4278f8ab5435

Author: Luuk de Gram

Committer: Luuk de Gram

## Message

```
wasm: Use 'select' instruction for max/min

Rather than using blocks and control flow to check which operand is the maximum or minimum,
we use wasm's `select` instruction which returns us the operand based on a result from a comparison.
This saves us the need of control flow, as well as reduce the instruction count from 13 to 7.

```

## Parents

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

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