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.
This commit is contained in:
simonb 2002-10-22 02:53:59 +00:00
parent ddac8bbac4
commit 8b9702b758

View File

@ -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 @@ tcp_new_iss1(void *laddr, void *faddr, u_int16_t lport, u_int16_t fport,
/*
* 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);