PERFORCE change 95827 for review

Warner Losh imp at FreeBSD.org
Fri Apr 21 21:13:54 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=95827

Change 95827 by imp at imp_hammer on 2006/04/21 21:13:17

	Apply SWAP16 to constants rather than non-constants.  This saves
	another 70ish bytes

Affected files ...

.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/emac.c#8 edit

Differences ...

==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/emac.c#8 (text+ko) ====

@@ -147,7 +147,7 @@
 
 	udpHdr = (udp_header_t*)(ipHdr + 1);
 
-	udpHdr->src_port  = SWAP16(localPort);
+	udpHdr->src_port  = localPort;
 	udpHdr->dst_port  = serverPort;
 	udpHdr->udp_len   = SWAP16(8 + tftpLength);
 	udpHdr->udp_cksum = 0;
@@ -324,14 +324,14 @@
 			udpHdr = (udp_header_t*)((char*)pIpHeader+20);
 			tftpHdr = (tftp_header_t*)((char*)udpHdr + 8);
 
-			if (SWAP16(udpHdr->dst_port) != localPort)
+			if (udpHdr->dst_port != localPort)
 				break;
 
-			if (SWAP16(tftpHdr->opcode) != TFTP_DATA_OPCODE)
+			if (tftpHdr->opcode != SWAP16(TFTP_DATA_OPCODE))
 				break;
 
 			if (ackBlock == -1) {
-				if (SWAP16(tftpHdr->block_num) != 1)
+				if (tftpHdr->block_num != SWAP16(1))
 					break;
 				serverPort = udpHdr->src_port;
 				ackBlock = 0;
@@ -667,7 +667,7 @@
 	serverMACSet = 0;
 	localIPSet = 0;
 	serverIPSet = 0;
-	localPort = 0x8002;
+	localPort = SWAP16(0x8002);
 	lastAddress = 0;
 	lastSize = 0;
 	MAC_init = 0;


More information about the p4-projects mailing list