Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1203919 > unrolled thread

[PATCH] isdn:remove reverse_bits(), use revbit8()

Started byyalin wang <yalin.wang2010@gmail.com>
First post2015-08-10 11:20 +0200
Last post2015-08-11 03:40 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] isdn:remove reverse_bits(), use revbit8()  yalin wang <yalin.wang2010@gmail.com> - 2015-08-10 11:20 +0200
    Re: [PATCH] isdn:remove reverse_bits(), use revbit8()  David Miller <davem@davemloft.net> - 2015-08-10 23:40 +0200
      Re: [PATCH] isdn:remove reverse_bits(), use revbit8()  yalin wang <yalin.wang2010@gmail.com> - 2015-08-11 03:40 +0200

#1203919 — [PATCH] isdn:remove reverse_bits(), use revbit8()

Fromyalin wang <yalin.wang2010@gmail.com>
Date2015-08-10 11:20 +0200
Subject[PATCH] isdn:remove reverse_bits(), use revbit8()
Message-ID<pVRpp-1Iy-17@gated-at.bofh.it>
This change isdn driver, remove reverse_bits() function,
use the generic revbit8() function instead.

Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
---
 drivers/isdn/mISDN/dsp_audio.c | 22 +++++-----------------
 1 file changed, 5 insertions(+), 17 deletions(-)

diff --git a/drivers/isdn/mISDN/dsp_audio.c b/drivers/isdn/mISDN/dsp_audio.c
index 0602295..bbef98e 100644
--- a/drivers/isdn/mISDN/dsp_audio.c
+++ b/drivers/isdn/mISDN/dsp_audio.c
@@ -13,6 +13,7 @@
 #include <linux/mISDNif.h>
 #include <linux/mISDNdsp.h>
 #include <linux/export.h>
+#include <linux/bitrev.h>
 #include "core.h"
 #include "dsp.h"
 
@@ -137,27 +138,14 @@ static unsigned char linear2ulaw(short sample)
 	return ulawbyte;
 }
 
-static int reverse_bits(int i)
-{
-	int z, j;
-	z = 0;
-
-	for (j = 0; j < 8; j++) {
-		if ((i & (1 << j)) != 0)
-			z |= 1 << (7 - j);
-	}
-	return z;
-}
-
-
 void dsp_audio_generate_law_tables(void)
 {
 	int i;
 	for (i = 0; i < 256; i++)
-		dsp_audio_alaw_to_s32[i] = alaw2linear(reverse_bits(i));
+		dsp_audio_alaw_to_s32[i] = alaw2linear(bitrev8((u8)i));
 
 	for (i = 0; i < 256; i++)
-		dsp_audio_ulaw_to_s32[i] = ulaw2linear(reverse_bits(i));
+		dsp_audio_ulaw_to_s32[i] = ulaw2linear(bitrev8((u8)i));
 
 	for (i = 0; i < 256; i++) {
 		dsp_audio_alaw_to_ulaw[i] =
@@ -176,13 +164,13 @@ dsp_audio_generate_s2law_table(void)
 		/* generating ulaw-table */
 		for (i = -32768; i < 32768; i++) {
 			dsp_audio_s16_to_law[i & 0xffff] =
-				reverse_bits(linear2ulaw(i));
+				bitrev8(linear2ulaw(i));
 		}
 	} else {
 		/* generating alaw-table */
 		for (i = -32768; i < 32768; i++) {
 			dsp_audio_s16_to_law[i & 0xffff] =
-				reverse_bits(linear2alaw(i));
+				bitrev8(linear2alaw(i));
 		}
 	}
 }
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1204575

FromDavid Miller <davem@davemloft.net>
Date2015-08-10 23:40 +0200
Message-ID<pW2Xv-1EC-5@gated-at.bofh.it>
In reply to#1203919
From: yalin wang <yalin.wang2010@gmail.com>
Date: Mon, 10 Aug 2015 17:15:57 +0800

> This change isdn driver, remove reverse_bits() function,
> use the generic revbit8() function instead.
> 
> Signed-off-by: yalin wang <yalin.wang2010@gmail.com>

Applied, however please format your Subject lines better in the
future.

There should be a space after the subsystem specifier and the ':'
character.  So "isdn: "

Then you should capitalize the description in the Subject line
because it is very much like an English sentence.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1204676

Fromyalin wang <yalin.wang2010@gmail.com>
Date2015-08-11 03:40 +0200
Message-ID<pW6HL-75p-9@gated-at.bofh.it>
In reply to#1204575
> On Aug 11, 2015, at 05:30, David Miller <davem@davemloft.net> wrote:
> 
> From: yalin wang <yalin.wang2010@gmail.com>
> Date: Mon, 10 Aug 2015 17:15:57 +0800
> 
>> This change isdn driver, remove reverse_bits() function,
>> use the generic revbit8() function instead.
>> 
>> Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
> 
> Applied, however please format your Subject lines better in the
> future.
> 
> There should be a space after the subsystem specifier and the ':'
> character.  So "isdn: "
> 
> Then you should capitalize the description in the Subject line
> because it is very much like an English sentence.
i see,
Thanks for your kindly remind !
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web