Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet Micro-optimisation: don't check if the high bit ...



details:   https://anonhg.NetBSD.org/src/rev/e02253943a7a
branches:  trunk
changeset: 538517:e02253943a7a
user:      simonb <simonb%NetBSD.org@localhost>
date:      Tue Oct 22 02:53:59 2002 +0000

description:
Micro-optimisation: don't check if the high bit is set and then mask it
off - just mask it off anyways.  Saves a branch 50% of the time.

diffstat:

 sys/netinet/tcp_subr.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (31 lines):

diff -r 36fe9bf85e39 -r e02253943a7a sys/netinet/tcp_subr.c
--- a/sys/netinet/tcp_subr.c    Tue Oct 22 02:44:34 2002 +0000
+++ b/sys/netinet/tcp_subr.c    Tue Oct 22 02:53:59 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_subr.c,v 1.134 2002/09/25 11:19:23 itojun Exp $    */
+/*     $NetBSD: tcp_subr.c,v 1.135 2002/10/22 02:53:59 simonb Exp $    */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -102,7 +102,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.134 2002/09/25 11:19:23 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.135 2002/10/22 02:53:59 simonb Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -2074,9 +2074,10 @@
                /*
                 * Limit it to the positive range for really old TCP
                 * implementations.
+                * Just AND off the tip bit instead of checking if
+                * is set first - saves a branch 50% of the time.
                 */
-               if (tcp_iss >= 0x80000000)
-                       tcp_iss &= 0x7fffffff;          /* XXX */
+               tcp_iss &= 0x7fffffff;          /* XXX */
        }
 
        return (tcp_iss);



Home | Main Index | Thread Index | Old Index