# x86_64: implement integer saturating left shifting codegen · gitcafe/zig

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

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

Visibility: public

Requested revision: 4e32193de33df13a90499bc4b678b4b69716018c

Requested commit: 4e32193de33df13a90499bc4b678b4b69716018c

Commit: 4e32193de33df13a90499bc4b678b4b69716018c

Tree: b16e0c98c4face146e72d080d4c4659536277361

Author: xtex

Committer: Bingwu Zhang

## Message

```
x86_64: implement integer saturating left shifting codegen

Simliarly to shl_with_overflow, we first SHL/SAL the integer, then
SHR/SAR it back to compare if overflow happens.
If overflow happened, set result to the upper limit to make it saturating.

Bug: #17645
Co-authored-by: Jacob Young <jacobly0@users.noreply.github.com>
Signed-off-by: Bingwu Zhang <xtex@aosc.io>

```

## Parents

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

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