lkml.org 
[lkml]   [2020]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC] Reed-Solomon Code: Update no_eras to the actual number of errors
From
Date
On Wed, 2020-06-24 at 22:35 -0700, Kees Cook wrote:
> On Wed, Jun 24, 2020 at 09:10:53PM -0700, Aiden Leong wrote:
> > Corr and eras_pos are updated to actual correction pattern and erasure
> > positions, but no_eras is not.
[]
> > @@ -312,14 +313,21 @@
> > eras_pos[j++] = loc[i] - pad;
> > }
> > }
> > + if (no_eras > 0)
> > + *no_eras = j;
>
> Is this meant to be "if (j > 0)" or "if (no_eras != NULL)" ? It's
> uncommon to use > 0 for a pointer value.
>
> > } else if (data && par) {
> > /* Apply error to data and parity */
> > + j = 0;
> > for (i = 0; i < count; i++) {
> > if (loc[i] < (nn - nroots))
> > data[loc[i] - pad] ^= b[i];
> > else
> > par[loc[i] - pad - len] ^= b[i];
> > + if (b[i])
> > + j++;
> > }
> > + if (no_eras > 0)
> > + *no_eras = j;
>
> I assume it's a pointer test, so both would be:
>
> if (no_eras_ptr != NULL)
> *no_eras_ptr = j;

More common still would be

if (no_eras_ptr)
*no_eras_ptr = j;

though I think using _ptr is too Hungarian.


\
 
 \ /
  Last update: 2020-06-25 07:52    [W:0.079 / U:0.368 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site