Subject: Re: 3com 3c990 testers needed
To: None <M.Drochner@fz-juelich.de>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: current-users
Date: 07/08/2003 00:59:24
In article <200307071548.RAA0000142087@zel459.zel.kfa-juelich.de>
M.Drochner@fz-juelich.de wrote:

> if you have such a card, please give the txp(4) driver
> a try.

I don't have the card, but I'd like to fix some bogus
htoleXX() usage:

--- if_txp.c.orig	2003-07-08 00:49:47.000000000 +0900
+++ if_txp.c	2003-07-08 00:53:06.000000000 +0900
@@ -240,14 +240,12 @@
 
 	txp_set_filter(sc);
 
-	p1 = htole16(p1);
-	enaddr[0] = ((u_int8_t *)&p1)[1];
-	enaddr[1] = ((u_int8_t *)&p1)[0];
-	p2 = htole32(p2);
-	enaddr[2] = ((u_int8_t *)&p2)[3];
-	enaddr[3] = ((u_int8_t *)&p2)[2];
-	enaddr[4] = ((u_int8_t *)&p2)[1];
-	enaddr[5] = ((u_int8_t *)&p2)[0];
+	enaddr[0] = (p1 >>  8) & 0xff;
+	enaddr[1] =  p1        & 0xff;
+	enaddr[2] = (p2 >> 24) & 0xff;
+	enaddr[3] = (p2 >> 16) & 0xff;
+	enaddr[4] = (p2 >>  8) & 0xff;
+	enaddr[5] =  p2        & 0xff;
 
 	printf(" address %s\n", ether_sprintf(enaddr));
 	sc->sc_cold = 0;

---

Current code would work, but it's ugly a little.
---
Izumi Tsutsui
tsutsui@ceres.dti.ne.jp