lkml.org 
[lkml]   [2022]   [Jun]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2 4/5] rslib: Improve the performance of encode_rs.c
From
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

\
 
 \ /
  Last update: 2022-06-19 03:30    [W:0.072 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site