Messages in this thread | | | Date | Sat, 18 Jun 2022 18:29:18 -0700 | Subject | Re: [PATCH v2 4/5] rslib: Improve the performance of encode_rs.c | From | Randy Dunlap <> |
| |
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
| |