Re: [PATCH v2 next] tools/nolibc: Optimise and common up the number to ascii functions

From: David Laight

Date: Mon Feb 16 2026 - 17:16:33 EST


On Mon, 16 Feb 2026 19:46:12 +0100
Thomas Weißschuh <linux@xxxxxxxxxxxxxx> wrote:

> On 2026-02-13 11:08:59+0000, David Laight wrote:
> > On Sun, 8 Feb 2026 19:53:08 +0000
> > david.laight.linux@xxxxxxxxx wrote:
> >
> > > From: David Laight <david.laight.linux@xxxxxxxxx>
> > >
> > > Implement u[64]to[ah]_r() using a common function that uses multiply
> > > by reciprocal to generate the least significant digit first and then
> > > reverses the string.
> >
> > Self-nak on this version :-(
> >
> > The division code can end up generating a negative remainder for
> > very large values (probably only ones over 1<<63).
>
> Ok. Maybe some tests for these edgecases are in order, too.
> Do you want to add them?

The problem is I'm not sure how to decide where they are.
The v1 patch is fine, it expects to get a large remainder and then
fixes up the error.
I could make the code just work for 8, 10 and 16 - but that is 'wimping out'.

David

>
>
> Thomas