public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: David Desobry <david.desobry@formalgen.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
	tglx@kernel.org, mingo@redhat.com, bp@alien8.de,
	dave.hansen@linux.intel.com, x86@kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/lib: Fix num_digits() signed overflow for INT_MIN
Date: Tue, 20 Jan 2026 22:15:28 +0000	[thread overview]
Message-ID: <20260120221528.648bc9a2@pumpkin> (raw)
In-Reply-To: <6d28349e-9912-474d-a750-71488e2fc976@formalgen.com>

On Tue, 20 Jan 2026 18:48:54 +0100
David Desobry <david.desobry@formalgen.com> wrote:

> Fair point! I've sent a v2 that replaces the loop with a switch 
> statement (using GCC ranges). It's faster,

Look at the 'crap' that clang generates.
And remember that mispredicted branches are expensive and the default
is either 'random', 'not taken' or 'backwards branches taken'.
It is likely better to have a lot of not-taken branches than a binary tree.

	David

  reply	other threads:[~2026-01-20 22:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-20  9:42 [PATCH] x86/lib: Fix num_digits() signed overflow for INT_MIN David Desobry
2026-01-20 16:23 ` H. Peter Anvin
2026-01-20 16:40   ` Borislav Petkov
2026-01-20 18:02     ` H. Peter Anvin
2026-01-20 18:17       ` H. Peter Anvin
2026-01-20 19:16         ` Borislav Petkov
2026-01-20 19:50           ` H. Peter Anvin
2026-01-20 20:13             ` Borislav Petkov
2026-01-21 10:59               ` David Laight
     [not found]           ` <14738799-afb2-428b-9829-f1ed038f3872@formalgen.com>
2026-01-20 20:24             ` H. Peter Anvin
2026-01-20 21:22               ` Borislav Petkov
2026-01-20 21:21             ` Borislav Petkov
2026-01-20 17:48   ` David Desobry
2026-01-20 22:15     ` David Laight [this message]
2026-01-20 18:58   ` David Laight

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260120221528.648bc9a2@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=david.desobry@formalgen.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox