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

📄 hashfn.c

📁 PostgreSQL 8.1.4的源码 适用于Linux下的开源数据库系统
💻 C
字号:
/*------------------------------------------------------------------------- * * hashfn.c *		Hash functions for use in dynahash.c hashtables * * * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * * IDENTIFICATION *	  $PostgreSQL: pgsql/src/backend/utils/hash/hashfn.c,v 1.25 2005/10/15 02:49:33 momjian Exp $ * *------------------------------------------------------------------------- */#include "postgres.h"#include "access/hash.h"#include "nodes/bitmapset.h"#include "utils/hsearch.h"/* * string_hash: hash function for keys that are null-terminated strings. * * NOTE: this is the default hash function if none is specified. */uint32string_hash(const void *key, Size keysize){	return DatumGetUInt32(hash_any((const unsigned char *) key,								   (int) strlen((const char *) key)));}/* * tag_hash: hash function for fixed-size tag values */uint32tag_hash(const void *key, Size keysize){	return DatumGetUInt32(hash_any((const unsigned char *) key,								   (int) keysize));}/* * oid_hash: hash function for keys that are OIDs * * (tag_hash works for this case too, but is slower) */uint32oid_hash(const void *key, Size keysize){	Assert(keysize == sizeof(Oid));	/* We don't actually bother to do anything to the OID value ... */	return (uint32) *((const Oid *) key);}/* * bitmap_hash: hash function for keys that are (pointers to) Bitmapsets * * Note: don't forget to specify bitmap_match as the match function! */uint32bitmap_hash(const void *key, Size keysize){	Assert(keysize == sizeof(Bitmapset *));	return bms_hash_value(*((const Bitmapset *const *) key));}/* * bitmap_match: match function to use with bitmap_hash */intbitmap_match(const void *key1, const void *key2, Size keysize){	Assert(keysize == sizeof(Bitmapset *));	return !bms_equal(*((const Bitmapset *const *) key1),					  *((const Bitmapset *const *) key2));}

⌨️ 快捷键说明

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