Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit07b95c3

Browse files
committed
Move bitmap_hash and bitmap_match to bitmapset.c.
The closely-related function bms_hash_value is already defined in thatfile, and this change means that hashfn.c no longer needs to depend onnodes/bitmapset.h. That gets us closer to allowing use of the hashfunctions 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
1 parentbf883b2 commit07b95c3

File tree

4 files changed

+25
-26
lines changed

4 files changed

+25
-26
lines changed

‎src/backend/nodes/bitmapset.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,3 +1167,26 @@ bms_hash_value(const Bitmapset *a)
11671167
returnDatumGetUInt32(hash_any((constunsignedchar*)a->words,
11681168
(lastword+1)*sizeof(bitmapword)));
11691169
}
1170+
1171+
/*
1172+
* bitmap_hash - hash function for keys that are (pointers to) Bitmapsets
1173+
*
1174+
* Note: don't forget to specify bitmap_match as the match function!
1175+
*/
1176+
uint32
1177+
bitmap_hash(constvoid*key,Sizekeysize)
1178+
{
1179+
Assert(keysize==sizeof(Bitmapset*));
1180+
returnbms_hash_value(*((constBitmapset*const*)key));
1181+
}
1182+
1183+
/*
1184+
* bitmap_match - match function to use with bitmap_hash
1185+
*/
1186+
int
1187+
bitmap_match(constvoid*key1,constvoid*key2,Sizekeysize)
1188+
{
1189+
Assert(keysize==sizeof(Bitmapset*));
1190+
return !bms_equal(*((constBitmapset*const*)key1),
1191+
*((constBitmapset*const*)key2));
1192+
}

‎src/backend/utils/hash/hashfn.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include"postgres.h"
2424

2525
#include"fmgr.h"
26-
#include"nodes/bitmapset.h"
2726
#include"utils/hashutils.h"
2827
#include"utils/hsearch.h"
2928

@@ -695,26 +694,3 @@ uint32_hash(const void *key, Size keysize)
695694
Assert(keysize==sizeof(uint32));
696695
returnDatumGetUInt32(hash_uint32(*((constuint32*)key)));
697696
}
698-
699-
/*
700-
* bitmap_hash: hash function for keys that are (pointers to) Bitmapsets
701-
*
702-
* Note: don't forget to specify bitmap_match as the match function!
703-
*/
704-
uint32
705-
bitmap_hash(constvoid*key,Sizekeysize)
706-
{
707-
Assert(keysize==sizeof(Bitmapset*));
708-
returnbms_hash_value(*((constBitmapset*const*)key));
709-
}
710-
711-
/*
712-
* bitmap_match: match function to use with bitmap_hash
713-
*/
714-
int
715-
bitmap_match(constvoid*key1,constvoid*key2,Sizekeysize)
716-
{
717-
Assert(keysize==sizeof(Bitmapset*));
718-
return !bms_equal(*((constBitmapset*const*)key1),
719-
*((constBitmapset*const*)key2));
720-
}

‎src/include/nodes/bitmapset.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,7 @@ extern intbms_prev_member(const Bitmapset *a, int prevbit);
116116

117117
/* support for hashtables using Bitmapsets as keys: */
118118
externuint32bms_hash_value(constBitmapset*a);
119+
externuint32bitmap_hash(constvoid*key,Sizekeysize);
120+
externintbitmap_match(constvoid*key1,constvoid*key2,Sizekeysize);
119121

120122
#endif/* BITMAPSET_H */

‎src/include/utils/hsearch.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,6 @@ extern void AtEOSubXact_HashTables(bool isCommit, int nestDepth);
152152
externuint32string_hash(constvoid*key,Sizekeysize);
153153
externuint32tag_hash(constvoid*key,Sizekeysize);
154154
externuint32uint32_hash(constvoid*key,Sizekeysize);
155-
externuint32bitmap_hash(constvoid*key,Sizekeysize);
156-
externintbitmap_match(constvoid*key1,constvoid*key2,Sizekeysize);
157155

158156
#defineoid_hash uint32_hash/* Remove me eventually */
159157

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp