On Mai 17 2024, Grisha Levit wrote:
> The current cmp implementation for size and blocks subtracts the two
> values and returns the difference as an int. This subtraction can
> overflow, and the returned int can end up having the wrong sign.
In the case of globsort_sizecmp, since off_t is wider t
On 5/20/24 10:07 AM, alex xmb sw ratchev wrote:
> FWIW, I was copying the approach from coreutils[1] and gnulib[2]:
Sure. I'm going to stick with code clarity and uniformity over micro
optimizations here. Maybe I could hide it in a macro.
an if overflow sounds like an important t
On Mon, May 20, 2024, 15:58 Chet Ramey wrote:
> On 5/17/24 5:56 PM, Grisha Levit wrote:
> > On Fri, May 17, 2024 at 3:06 PM Chet Ramey wrote:
> >>
> >> On 5/17/24 12:57 PM, Grisha Levit wrote:
> >>> The current cmp implementation for size and blocks subtracts the two
> >>> values and returns the
On 5/17/24 5:56 PM, Grisha Levit wrote:
On Fri, May 17, 2024 at 3:06 PM Chet Ramey wrote:
On 5/17/24 12:57 PM, Grisha Levit wrote:
The current cmp implementation for size and blocks subtracts the two
values and returns the difference as an int. This subtraction can
overflow, and the returned
On Fri, May 17, 2024 at 3:06 PM Chet Ramey wrote:
>
> On 5/17/24 12:57 PM, Grisha Levit wrote:
> > The current cmp implementation for size and blocks subtracts the two
> > values and returns the difference as an int. This subtraction can
> > overflow, and the returned int can end up having the wro
On 5/17/24 12:57 PM, Grisha Levit wrote:
The current cmp implementation for size and blocks subtracts the two
values and returns the difference as an int. This subtraction can
overflow, and the returned int can end up having the wrong sign.
This also makes the qsort comparison function non-trans
Date:Fri, 17 May 2024 12:57:25 -0400
From:Grisha Levit
Message-ID: <20240517165738.8896-1-grishale...@gmail.com>
| The current cmp implementation for size and blocks subtracts the two
| values and returns the difference as an int. This subtraction can
| overflow