[PATCH] Suggested FreeBSD merge

Xin LI delphij at frontfree.net
Thu Nov 11 21:40:53 PST 2004


Hi,

I think you would interest the patch attached.  This brings FreeBSD
rev. 1.10 of htonl.S and ntohl.S's changes by David O'Brien, which
is positive for application performance on 80486 and above.

Cheers,
-- 
Xin LI <delphij frontfree net>	http://www.delphij.net/
See complete headers for GPG key and other information.

Index: htonl.S
===================================================================
RCS file: /home/dcvs/src/lib/libc/i386/net/htonl.S,v
retrieving revision 1.3
diff -u -r1.3 htonl.S
--- htonl.S	6 Dec 2003 03:11:35 -0000	1.3
+++ htonl.S	12 Nov 2004 05:33:48 -0000
@@ -43,7 +43,11 @@
 
 ENTRY(htonl)
 	movl	4(%esp),%eax
+#ifdef I386_CPU
 	xchgb	%al,%ah
 	roll	$16,%eax
 	xchgb	%al,%ah
+#else
+	bswap	%eax
+#endif
 	ret
Index: ntohl.S
===================================================================
RCS file: /home/dcvs/src/lib/libc/i386/net/ntohl.S,v
retrieving revision 1.3
diff -u -r1.3 ntohl.S
--- ntohl.S	6 Dec 2003 03:11:35 -0000	1.3
+++ ntohl.S	12 Nov 2004 05:34:37 -0000
@@ -43,7 +43,11 @@
 
 ENTRY(ntohl)
 	movl	4(%esp),%eax
+#ifdef I386_CPU
 	xchgb	%al,%ah
 	roll	$16,%eax
 	xchgb	%al,%ah
+#else
+	bswap	%eax
+#endif
 	ret
Attachment:
pgp00002.pgp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00002.pgp
Type: application/octet-stream
Size: 187 bytes
Desc: "Description: PGP signature"
URL: <http://lists.dragonflybsd.org/pipermail/submit/attachments/20041111/e79a74d1/attachment-0018.obj>


More information about the Submit mailing list