lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20140520183222.578268622a7c1f25eaacfd99@skynet.be>
Date:	Tue, 20 May 2014 18:32:22 +0200
From:	Fabian Frederick <fabf@...net.be>
To:	linux-kernel <linux-kernel@...r.kernel.org>
Cc:	akpm <akpm@...ux-foundation.org>,
	Mauro Carvalho Chehab <m.chehab@...sung.com>
Subject: [PATCH 1/1] drivers/media/dvb-frontends/dib7000p.c: replace shift
 loop by ilog2


Cc: Mauro Carvalho Chehab <m.chehab@...sung.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Signed-off-by: Fabian Frederick <fabf@...net.be>
---
 drivers/media/dvb-frontends/dib7000p.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/media/dvb-frontends/dib7000p.c b/drivers/media/dvb-frontends/dib7000p.c
index effb87f..d40dcd5 100644
--- a/drivers/media/dvb-frontends/dib7000p.c
+++ b/drivers/media/dvb-frontends/dib7000p.c
@@ -1783,7 +1783,7 @@ static const s32 lut_1000ln_mant[] = {
 static s32 dib7000p_get_adc_power(struct dvb_frontend *fe)
 {
 	struct dib7000p_state *state = fe->demodulator_priv;
-	u32 tmp_val = 0, exp = 0, mant = 0;
+	u32 exp = 0, mant = 0;
 	s32 pow_i;
 	u16 buf[2];
 	u8 ix = 0;
@@ -1793,10 +1793,7 @@ static s32 dib7000p_get_adc_power(struct dvb_frontend *fe)
 	pow_i = (buf[0] << 16) | buf[1];
 	dprintk("raw pow_i = %d", pow_i);
 
-	tmp_val = pow_i;
-	while (tmp_val >>= 1)
-		exp++;
-
+	exp = ilog2(pow_i);
 	mant = (pow_i * 1000 / (1 << exp));
 	dprintk(" mant = %d exp = %d", mant / 1000, exp);
 
-- 
1.8.4.5

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ