mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-01-18 15:15:56 +08:00
[svn-r2191] Changed hash function for caching to avoid as many hash clashes.
This commit is contained in:
parent
932d6e3804
commit
b0f996f5fb
@ -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 &&
|
||||
|
@ -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 &&
|
||||
|
Loading…
Reference in New Issue
Block a user