On Sun, Jun 30, 2024 at 9:09 PM Roger Sayle wrote:
>
>
> Hi Uros,
> > On Sat, Jun 29, 2024 at 6:21 PM Roger Sayle
> > wrote:
> > > A common idiom for implementing an integer division that rounds
> > > upwards is to write (x + y - 1) / y. Conveniently on x86, the two
> > > additions to form the n
Hi Uros,
> On Sat, Jun 29, 2024 at 6:21 PM Roger Sayle
> wrote:
> > A common idiom for implementing an integer division that rounds
> > upwards is to write (x + y - 1) / y. Conveniently on x86, the two
> > additions to form the numerator can be performed by a single lea
> > instruction, and ind
On Sat, Jun 29, 2024 at 6:21 PM Roger Sayle wrote:
>
>
> A common idiom for implementing an integer division that rounds upwards is
> to write (x + y - 1) / y. Conveniently on x86, the two additions to form
> the numerator can be performed by a single lea instruction, and indeed gcc
> currently g
A common idiom for implementing an integer division that rounds upwards is
to write (x + y - 1) / y. Conveniently on x86, the two additions to form
the numerator can be performed by a single lea instruction, and indeed gcc
currently generates a lea when x and y both registers.
int foo(int x, int