projects
/
rrq
/
rrqmisc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
a4e15c5
)
reworked hasing with "query"
author
Ralph Ronnquist
<ralph.ronnquist@gmail.com>
Fri, 8 Jul 2022 05:16:12 +0000
(15:16 +1000)
committer
Ralph Ronnquist
<ralph.ronnquist@gmail.com>
Fri, 8 Jul 2022 05:16:12 +0000
(15:16 +1000)
vector/tupleitem.c
patch
|
blob
|
history
diff --git
a/vector/tupleitem.c
b/vector/tupleitem.c
index c63e3ec1072bb3544af68f74fa39e46a7840b412..ad1326735e816c5fa7989378c8e0f1fcfe81bb69 100644
(file)
--- a/
vector/tupleitem.c
+++ b/
vector/tupleitem.c
@@
-26,11
+26,15
@@
static unsigned long tupleitem_hashcode(void *this,void *key) {
tupleschema *def = (tupleschema *) this;
tuple *kp = (tuple*) key;
int i = 0;
tupleschema *def = (tupleschema *) this;
tuple *kp = (tuple*) key;
int i = 0;
- unsigned long value =
0
;
+ unsigned long value =
5381
;
for ( ; i < def->arity; i++ ) {
if ( COLUMN[i] ) {
value <<= 3;
for ( ; i < def->arity; i++ ) {
if ( COLUMN[i] ) {
value <<= 3;
- value += COLUMN[i]->hashcode( COLUMN[i], (*kp)[i] );
+ if ( (*kp)[i] ) {
+ value += COLUMN[i]->hashcode( COLUMN[i], (*kp)[i] );
+ } else {
+ value += 17;
+ }
}
}
return value;
}
}
return value;
@@
-46,15
+50,10
@@
static int tupleitem_haskey(void *this,void *item,void *key) {
tuple *tp = (tuple*) item;
int i = 0;
for ( ; i < def->arity; i++ ) {
tuple *tp = (tuple*) item;
int i = 0;
for ( ; i < def->arity; i++ ) {
- if ( COLUMN[i]
== 0
) {
- if (
(*kp)[i] && (*tp)[i] != (*kp)[i]
) {
+ if ( COLUMN[i]
&& (*kp)[i]
) {
+ if (
COLUMN[i]->haskey( COLUMN[i], (*tp)[i], (*kp)[i] ) == 0
) {
return 0;
}
return 0;
}
- continue;
- }
- if ( (*kp)[i] &&
- COLUMN[i]->haskey( COLUMN[i], (*tp)[i], (*kp)[i] ) == 0 ) {
- return 0;
}
}
return 1;
}
}
return 1;