⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rthash.c,v

📁 关于IP协议方面的
💻 C,V
字号:
head	1.1;access;symbols;locks	dls:1.1; strict;comment	@ * @;1.1date	97.09.21.19.27.09;	author dls;	state Dist;branches;next	;desc@@1.1log@pre-3e code@text@/* rthash.c - rthash */#include <conf.h>#include <kernel.h>#include <network.h>/*------------------------------------------------------------------------ *  rthash  -  compute the hash for "net" *------------------------------------------------------------------------ */int rthash(net)IPaddr	net;{	int		bc = IP_ALEN;	/* # bytes to count	*/	unsigned int	hv = 0;		/* hash value		*/	if (IP_CLASSA(net)) bc = 1;	else if (IP_CLASSB(net)) bc = 2;	else if (IP_CLASSC(net)) bc = 3;	else if (IP_CLASSD(net))		return ((net>>24) & 0xf0) % RT_TSIZE;	while (bc--)		hv += ((char *)&net)[bc] & 0xff;	return hv % RT_TSIZE;}@

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -