Skip to content
Permalink
Browse files
lib/bch:using swap() instead of tmp variable
swap() was used instead of the tmp variable to swap values

Signed-off-by: Yihao Han <hanyihao@vivo.com>
  • Loading branch information
Yihao Han authored and intel-lab-lkp committed Nov 9, 2021
1 parent d2f38a3 commit 67120a42a5dc4e4a08d998ae4dc41d9bf31946b5
Showing 1 changed file with 4 additions and 12 deletions.
@@ -500,7 +500,7 @@ static int solve_linear_system(struct bch_control *bch, unsigned int *rows,
unsigned int *sol, int nsol)
{
const int m = GF_M(bch);
unsigned int tmp, mask;
unsigned int mask;
int rem, c, r, p, k, param[BCH_MAX_M];

k = 0;
@@ -514,9 +514,7 @@ static int solve_linear_system(struct bch_control *bch, unsigned int *rows,
for (r = p; r < m; r++) {
if (rows[r] & mask) {
if (r != p) {
tmp = rows[r];
rows[r] = rows[p];
rows[p] = tmp;
swap(rows[r], rows[p]);
}
rem = r+1;
break;
@@ -833,21 +831,15 @@ static void gf_poly_div(struct bch_control *bch, struct gf_poly *a,
static struct gf_poly *gf_poly_gcd(struct bch_control *bch, struct gf_poly *a,
struct gf_poly *b)
{
struct gf_poly *tmp;

dbg("gcd(%s,%s)=", gf_poly_str(a), gf_poly_str(b));

if (a->deg < b->deg) {
tmp = b;
b = a;
a = tmp;
swap(b, a);
}

while (b->deg > 0) {
gf_poly_mod(bch, a, b, NULL);
tmp = b;
b = a;
a = tmp;
swap(b, a);
}

dbg("%s\n", gf_poly_str(a));

0 comments on commit 67120a4

Please sign in to comment.