[PATCH] USB speedtouch: crc optimization

Duncan Sands (baldrick@wanadoo.fr)
Wed, 23 Apr 2003 10:50:53 +0200


--Boundary-00=_tPlp+jxSwMrh+CN
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

speedtch.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

diff -Nru a/drivers/usb/misc/speedtch.c b/drivers/usb/misc/speedtch.c
--- a/drivers/usb/misc/speedtch.c Wed Apr 23 10:48:07 2003
+++ b/drivers/usb/misc/speedtch.c Wed Apr 23 10:48:07 2003
@@ -406,11 +406,12 @@
** encode **
*************/

+static const unsigned char zeros[ATM_CELL_PAYLOAD];
+
static void udsl_groom_skb (struct atm_vcc *vcc, struct sk_buff *skb)
{
struct udsl_control *ctrl = UDSL_SKB (skb);
- unsigned int i, zero_padding;
- unsigned char zero = 0;
+ unsigned int zero_padding;
u32 crc;

ctrl->atm_data.vcc = vcc;
@@ -436,8 +437,7 @@
ctrl->aal5_trailer [3] = skb->len;

crc = crc32_be (~0, skb->data, skb->len);
- for (i = 0; i < zero_padding; i++)
- crc = crc32_be (crc, &zero, 1);
+ crc = crc32_be (crc, zeros, zero_padding);
crc = crc32_be (crc, ctrl->aal5_trailer, 4);
crc = ~crc;

--Boundary-00=_tPlp+jxSwMrh+CN
Content-Type: text/x-diff;
charset="us-ascii";
name="send-2.4.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="send-2.4.diff"

speedtouch.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

diff -Nru a/drivers/usb/speedtouch.c b/drivers/usb/speedtouch.c
--- a/drivers/usb/speedtouch.c Wed Apr 23 10:48:28 2003
+++ b/drivers/usb/speedtouch.c Wed Apr 23 10:48:28 2003
@@ -406,11 +406,12 @@
** encode **
*************/

+static const unsigned char zeros[ATM_CELL_PAYLOAD];
+
static void udsl_groom_skb (struct atm_vcc *vcc, struct sk_buff *skb)
{
struct udsl_control *ctrl = UDSL_SKB (skb);
- unsigned int i, zero_padding;
- unsigned char zero = 0;
+ unsigned int zero_padding;
u32 crc;

ctrl->atm_data.vcc = vcc;
@@ -436,8 +437,7 @@
ctrl->aal5_trailer [3] = skb->len;

crc = crc32_be (~0, skb->data, skb->len);
- for (i = 0; i < zero_padding; i++)
- crc = crc32_be (crc, &zero, 1);
+ crc = crc32_be (crc, zeros, zero_padding);
crc = crc32_be (crc, ctrl->aal5_trailer, 4);
crc = ~crc;

--Boundary-00=_tPlp+jxSwMrh+CN
Content-Type: text/x-diff;
charset="us-ascii";
name="send-2.5.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="send-2.5.diff"

speedtch.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

diff -Nru a/drivers/usb/misc/speedtch.c b/drivers/usb/misc/speedtch.c
--- a/drivers/usb/misc/speedtch.c Wed Apr 23 10:48:07 2003
+++ b/drivers/usb/misc/speedtch.c Wed Apr 23 10:48:07 2003
@@ -406,11 +406,12 @@
** encode **
*************/

+static const unsigned char zeros[ATM_CELL_PAYLOAD];
+
static void udsl_groom_skb (struct atm_vcc *vcc, struct sk_buff *skb)
{
struct udsl_control *ctrl = UDSL_SKB (skb);
- unsigned int i, zero_padding;
- unsigned char zero = 0;
+ unsigned int zero_padding;
u32 crc;

ctrl->atm_data.vcc = vcc;
@@ -436,8 +437,7 @@
ctrl->aal5_trailer [3] = skb->len;

crc = crc32_be (~0, skb->data, skb->len);
- for (i = 0; i < zero_padding; i++)
- crc = crc32_be (crc, &zero, 1);
+ crc = crc32_be (crc, zeros, zero_padding);
crc = crc32_be (crc, ctrl->aal5_trailer, 4);
crc = ~crc;

--Boundary-00=_tPlp+jxSwMrh+CN--
-
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/