# sort.binarySearch: fix integer underflow \(\#4980\) · gitcafe/zig

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

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

Visibility: public

Requested revision: 447dc2bb9011078e80acbe3f51135ff1ad2bf163

Requested commit: 447dc2bb9011078e80acbe3f51135ff1ad2bf163

Commit: 447dc2bb9011078e80acbe3f51135ff1ad2bf163

Tree: ba5f2446a0197bc5030e16a5fe21072abc667232

Author: Yuri Pieters

Committer: Yuri Pieters

## Message

```
sort.binarySearch: fix integer underflow (#4980)

When the key was smaller than any value in the array, an error was
ocurring with the mid being zero and having 1 subtracted from it.

```

## Parents

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

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