mirror of
https://github.com/postgres/postgres.git
synced 2025-08-31 17:02:12 +03:00
Move bitmap_hash and bitmap_match to bitmapset.c.
The closely-related function bms_hash_value is already defined in that file, and this change means that hashfn.c no longer needs to depend on nodes/bitmapset.h. That gets us closer to allowing use of the hash functions in hashfn.c in frontend code. Patch by me, reviewed by Suraj Kharage and Mark Dilger. Discussion: http://postgr.es/m/CA+TgmoaRiG4TXND8QuM6JXFRkM_1wL2ZNhzaUKsuec9-4yrkgw@mail.gmail.com
This commit is contained in:
@@ -23,7 +23,6 @@
|
||||
#include "postgres.h"
|
||||
|
||||
#include "fmgr.h"
|
||||
#include "nodes/bitmapset.h"
|
||||
#include "utils/hashutils.h"
|
||||
#include "utils/hsearch.h"
|
||||
|
||||
@@ -695,26 +694,3 @@ uint32_hash(const void *key, Size keysize)
|
||||
Assert(keysize == sizeof(uint32));
|
||||
return DatumGetUInt32(hash_uint32(*((const uint32 *) key)));
|
||||
}
|
||||
|
||||
/*
|
||||
* bitmap_hash: hash function for keys that are (pointers to) Bitmapsets
|
||||
*
|
||||
* Note: don't forget to specify bitmap_match as the match function!
|
||||
*/
|
||||
uint32
|
||||
bitmap_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
|
||||
*/
|
||||
int
|
||||
bitmap_match(const void *key1, const void *key2, Size keysize)
|
||||
{
|
||||
Assert(keysize == sizeof(Bitmapset *));
|
||||
return !bms_equal(*((const Bitmapset *const *) key1),
|
||||
*((const Bitmapset *const *) key2));
|
||||
}
|
||||
|
Reference in New Issue
Block a user