public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: David Laight <david.laight.linux@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Christophe Leroy <christophe.leroy@c-s.fr>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	nnac123@linux.ibm.com, horms@kernel.org
Subject: Re: [PATCH v2 1/1] lib: Optimise hex_dump_to_buffer()
Date: Mon, 10 Mar 2025 11:05:13 +0200	[thread overview]
Message-ID: <Z86rSd88eSiJxV-M@smile.fi.intel.com> (raw)
In-Reply-To: <20250308093421.3724-1-david.laight.linux@gmail.com>

On Sat, Mar 08, 2025 at 09:34:21AM +0000, David Laight wrote:
> Fastpath the normal case of single byte output that fits in the buffer.
> Output byte groups (byteswapped on little-endian) without calling snprintf().
> Remove the restriction that rowsize must be 16 or 32.
> (All callers currently pass 16 or 32.)
> Remove the restriction that groupsize must be 8 or less.
> If groupsize isn't a power of 2 or doesn't divide into both len and
>   rowsize it is set to 1 (otherwise byteswapping is hard).
> Change the types of the rowsize and groupsize parameters to be unsigned types.
> 
> Fix the return value (should be zero) when both len and linebuflen are zero.
> 
> All the updated tests in lib/test_hexdump.c pass.
> Code size (x86-64) approximately halved.

...

> -extern int hex_dump_to_buffer(const void *buf, size_t len, int rowsize,
> -			      int groupsize, char *linebuf, size_t linebuflen,
> -			      bool ascii);
> +extern size_t hex_dump_to_buffer(const void *buf, size_t len, size_t rowsize,

Why is extern still here?

> +				 size_t groupsize, char *linebuf,
> +				 size_t linebuflen, bool ascii);

int - > size_t in the returned value is incorrect change.
This is explained in the comments to the test cases patch series.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2025-03-10  9:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-08  9:34 [PATCH v2 1/1] lib: Optimise hex_dump_to_buffer() David Laight
2025-03-10  9:05 ` Andy Shevchenko [this message]
2025-03-12 19:18   ` David Laight
2025-03-12 19:31     ` Andy Shevchenko
2025-03-12 21:01       ` 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=Z86rSd88eSiJxV-M@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=christophe.leroy@c-s.fr \
    --cc=david.laight.linux@gmail.com \
    --cc=horms@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=nnac123@linux.ibm.com \
    --cc=torvalds@linux-foundation.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