All of lore.kernel.org
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: Zhang Boyang <zhangboyang.id@gmail.com>, linux-kernel@vger.kernel.org
Cc: Ferdinand Blomqvist <ferdinand.blomqvist@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Kees Cook <keescook@chromium.org>,
	Ivan Djelic <ivan.djelic@parrot.com>,
	Boris Brezillon <boris.brezillon@bootlin.com>,
	Miquel Raynal <miquel.raynal@bootlin.com>
Subject: Re: [PATCH v2 4/5] rslib: Improve the performance of encode_rs.c
Date: Sat, 18 Jun 2022 18:29:18 -0700	[thread overview]
Message-ID: <a31155a7-d7f4-2825-1e84-bb8a51815edd@infradead.org> (raw)
In-Reply-To: <20220617144624.158973-5-zhangboyang.id@gmail.com>

Hi--

On 6/17/22 07:46, Zhang Boyang wrote:
> Signed-off-by: Zhang Boyang <zhangboyang.id@gmail.com>
> ---
>  include/linux/rslib.h        | 14 +++++++++++++-
>  lib/reed_solomon/encode_rs.c | 21 ++++++++++-----------
>  2 files changed, 23 insertions(+), 12 deletions(-)
> 
> diff --git a/include/linux/rslib.h b/include/linux/rslib.h
> index cd0b5a7a5698..44ec7c6f24b2 100644
> --- a/include/linux/rslib.h
> +++ b/include/linux/rslib.h
> @@ -110,7 +110,7 @@ void free_rs(struct rs_control *rs);
>  /** modulo replacement for galois field arithmetics
>   *
>   *  @rs:	Pointer to the RS codec
> - *  @x:		the value to reduce
> + *  @x:		x >= 0 ; the value to reduce
>   *
>   *  where
>   *  rs->mm = number of bits per symbol
> @@ -127,4 +127,16 @@ static inline int rs_modnn(struct rs_codec *rs, int x)
>  	return x;
>  }
>  
> +/** modulo replacement for galois field arithmetics

/**
 * rs_modnn_fast() - modulo replacement for galois field arithmetics

> + *
> + *  @rs:	Pointer to the RS codec
> + *  @x:		0 <= x < 2*nn ; the value to reduce
> + *
> + *  Same as rs_modnn(x), but faster, at the cost of limited value range of @x
> +*/
> +static inline int rs_modnn_fast(struct rs_codec *rs, int x)
> +{
> +	return x - rs->nn < 0 ? x : x - rs->nn;
> +}
> +
>  #endif

-- 
~Randy

  reply	other threads:[~2022-06-19  1:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-17 14:46 rslib: Several improvements Zhang Boyang
2022-06-17 14:46 ` [PATCH v2 1/5] rslib: Fix incorrect documentation of rs_modnn() Zhang Boyang
2022-06-17 14:46 ` [PATCH v2 2/5] rslib: Fix obvious documentation mistakes Zhang Boyang
2022-06-17 14:46 ` [PATCH v2 3/5] rslib: Replace hard-coded 1 with alpha_to[0] Zhang Boyang
2022-06-17 14:46 ` [PATCH v2 4/5] rslib: Improve the performance of encode_rs.c Zhang Boyang
2022-06-19  1:29   ` Randy Dunlap [this message]
2022-06-17 14:46 ` [PATCH v2 5/5] rslib: Fix integer overflow on large fcr or prim Zhang Boyang
2022-06-19  1:26   ` Randy Dunlap

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=a31155a7-d7f4-2825-1e84-bb8a51815edd@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=boris.brezillon@bootlin.com \
    --cc=ferdinand.blomqvist@gmail.com \
    --cc=ivan.djelic@parrot.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=tglx@linutronix.de \
    --cc=zhangboyang.id@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.