# stage1: saturating shl operates using LHS type · gitcafe/zig

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

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

Visibility: public

Requested revision: 38b2d6209239f0dad7cb38e656d9d38506f126ca

Requested commit: 38b2d6209239f0dad7cb38e656d9d38506f126ca

Commit: 38b2d6209239f0dad7cb38e656d9d38506f126ca

Tree: 93482ff72c52c99608fd5514ee683f3fbec80e30

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
stage1: saturating shl operates using LHS type

Saturating shift left (`<<|`) previously used the `ir_analyze_bin_op_math`
codepath rather than the `ir_analyze_bit_shift` codepath, leading to it
doing peer type resolution (incorrect) instead of using the LHS type as
the number of bits to do the saturating against.

This required implementing SIMD vector support for `@truncate`.

Additionall, this commit adds a compile error for saturating shift left
on a comptime_int.

stage2 does not pass these new behavior tests yet.

closes #10298

```

## Parents

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

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