[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1434128353-10683-1-git-send-email-fabf@skynet.be>
Date: Fri, 12 Jun 2015 18:59:13 +0200
From: Fabian Frederick <fabf@...net.be>
To: linux-kernel@...r.kernel.org
Cc: Julia Lawall <Julia.Lawall@...6.fr>,
Fabian Frederick <fabf@...net.be>
Subject: [PATCH 1/1 linux-next] lib/bch.c: Use swap() in solve_linear_system() and gf_poly_gcd()
Use kernel.h macro definition.
Thanks to Julia Lawall for Coccinelle scripting support.
Signed-off-by: Fabian Frederick <fabf@...net.be>
---
lib/bch.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/lib/bch.c b/lib/bch.c
index bc89dfe..7e3d325 100644
--- a/lib/bch.c
+++ b/lib/bch.c
@@ -446,11 +446,9 @@ static int solve_linear_system(struct bch_control *bch, unsigned int *rows,
/* find suitable row for elimination */
for (r = p; r < m; r++) {
if (rows[r] & mask) {
- if (r != p) {
- tmp = rows[r];
- rows[r] = rows[p];
- rows[p] = tmp;
- }
+ if (r != p)
+ swap(rows[r], rows[p]);
+
rem = r+1;
break;
}
@@ -766,21 +764,14 @@ 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;
- }
+ if (a->deg < b->deg)
+ 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));
--
2.4.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists