# wasm: Fix \`@floatToInt\` and split overflow ops · gitcafe/zig

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

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

Visibility: public

Requested revision: ad4f0dda8b8c270594ed24a27c808f8bd43924bf

Requested commit: ad4f0dda8b8c270594ed24a27c808f8bd43924bf

Commit: ad4f0dda8b8c270594ed24a27c808f8bd43924bf

Tree: 13114b5847eaf3f578c43910cb0f772645951406

Author: Luuk de Gram

Committer: Luuk de Gram

## Message

```
wasm: Fix `@floatToInt` and split overflow ops

As we now store negative signed integers as two's complement,
we must also ensure that when truncating a float, its value is wrapped
around the integer's size.

This also splits `@mulWithOverflow` into its own function to make
the code more maintainable and reduce branching.

```

## Parents

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

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