# Sema: enhance div_trunc, div_exact, div_floor · gitcafe/zig

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

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

Visibility: public

Requested revision: 40f8f0134f5da9baaefd0fdab529d5585fa46199

Requested commit: 40f8f0134f5da9baaefd0fdab529d5585fa46199

Commit: 40f8f0134f5da9baaefd0fdab529d5585fa46199

Tree: d0204669c74b50f4ab971ea9422ac93685baafb5

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
Sema: enhance div_trunc, div_exact, div_floor

 * No longer emit div_exact AIR instruction that can produce a
   remainder, invoking undefined behavior.
 * div_trunc, div_exact, div_floor are extracted from analyzeArithmetic
   and directly handled similarly to div_trunc, integrating them with
   integer overflow safety checking.
 * Also they no longer emit divide-by-zero safety checking when RHS
   is comptime known to be non-zero.

```

## Parents

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

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