hash.h

来自「模仿cisco路由器」· C头文件 代码 · 共 52 行

H
52
字号
/*
	Copyright (C) 2002, 2003 Slava Astashonok <sla@0n.ru>

	This program is free software; you can redistribute it and/or
	modify it under the terms of the GNU General Public License.

	$Id: hash.h,v 1.1.1.1.2.1 2003/03/28 22:57:51 sla Exp $
*/

#ifndef _HASH_H_
#define _HASH_H_

#ifndef HASH_TYPE_XOR
# ifndef HASH_TYPE_CRC
#  error HASH_TYPE_XOR or HASH_TYPE_CRC must be defined
# endif
#else
# ifdef HASH_TYPE_CRC
#  error HASH_TYPE_XOR or HASH_TYPE_CRC must be defined
# endif
#endif

#if HASH_BITS != 16
# ifdef HASH_TYPE_CRC
#  error illegal value in HASH_BITS
# endif
# if HASH_BITS != 8
#  error illegal value in HASH_BITS
# endif
#endif

#define CRC16_POLY  0x8005
/*
#define CRC16_POLY  0x1021
*/

#include <inttypes.h>

#if HASH_BITS == 8
typedef uint8_t hash_t;
#endif

#if HASH_BITS == 16
typedef uint16_t hash_t;
#endif

uint16_t crc16(uint16_t, uint8_t);
hash_t hash(void *, int);
void hash_init();

#endif

⌨️ 快捷键说明

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