diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2000-04-22 21:19:41 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2000-04-22 21:19:41 (GMT) |
commit | b0f996f5fb38997184e2ef5a9fcb6d4199c8fdc8 (patch) | |
tree | aa093da68d6ef4cf0fa6c41ef714256d3077f36c /src/H5Distore.c | |
parent | 932d6e38044794866b9405d95788b23c8c2f4b92 (diff) | |
download | hdf5-b0f996f5fb38997184e2ef5a9fcb6d4199c8fdc8.zip hdf5-b0f996f5fb38997184e2ef5a9fcb6d4199c8fdc8.tar.gz hdf5-b0f996f5fb38997184e2ef5a9fcb6d4199c8fdc8.tar.bz2 |
[svn-r2191] Changed hash function for caching to avoid as many hash clashes.
Diffstat (limited to 'src/H5Distore.c')
-rw-r--r-- | src/H5Distore.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/H5Distore.c b/src/H5Distore.c index 17102f9..b0f7a39 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -175,16 +175,10 @@ H5B_class_t H5B_ISTORE[1] = {{ H5F_istore_debug_key, /*debug */ }}; -#define H5F_MIXUP(X) { \ - (X) += (X)<<12; \ - (X) ^= (X)>>22; \ - (X) += (X)<<4; \ - (X) ^= (X)>>9; \ - (X) += (X)<<10; \ - (X) ^= (X)>>2; \ - (X) += (X)<<7; \ - (X) ^= (X)>>12; \ -} +#define H5F_HASH_DIVISOR 8 /* Attempt to spread out the hashing */ + /* This should be the same size as the alignment of */ + /* of the smallest file format object written to the file. */ +#define H5F_HASH(F,ADDR) H5F_addr_hash((ADDR/H5F_HASH_DIVISOR),(F)->shared->rdcc.nslots) /* Declare a free list to manage the chunk information */ @@ -1348,13 +1342,12 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, if (rdcc->nslots>0) { /* We don't care about loss of precision in the following statement. */ - idx = (uintn)(layout->addr); - H5F_MIXUP(idx); - for (i=0; i<layout->ndims; i++) { + for (i=0, idx=0; i<layout->ndims; i++) { + idx *= layout->dim[i]; idx += offset[i]; - H5F_MIXUP(idx); } - idx %= rdcc->nslots; + idx += (uintn)(layout->addr); + idx=H5F_HASH(f,idx); ent = rdcc->slot[idx]; if (ent && |