diff options
author | Songyu Lu <songyulu@barracuda.ad.hdfgroup.org> | 2018-11-08 21:41:49 (GMT) |
---|---|---|
committer | Songyu Lu <songyulu@barracuda.ad.hdfgroup.org> | 2018-11-08 21:41:49 (GMT) |
commit | 3a13bb72e8d33808eb3bfd68c2a6b4ae5153f3a0 (patch) | |
tree | bdfae72d0cdd2c5ac8af8ed7c0123d8af1e2dcea /src/H5Dchunk.c | |
parent | 709704528cc5dcc37091fdcf1088951b4b95a61e (diff) | |
download | hdf5-3a13bb72e8d33808eb3bfd68c2a6b4ae5153f3a0.zip hdf5-3a13bb72e8d33808eb3bfd68c2a6b4ae5153f3a0.tar.gz hdf5-3a13bb72e8d33808eb3bfd68c2a6b4ae5153f3a0.tar.bz2 |
HDFFV-10601: I changed to a better way to calculate the number of chunks in a dataset.
Diffstat (limited to 'src/H5Dchunk.c')
-rw-r--r-- | src/H5Dchunk.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 7eeb866..cb6b925 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -950,11 +950,9 @@ H5D__chunk_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id) if(dset->shared->layout.u.chunk.dim[u] == 0) HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u) - /* Make a special case when the dimension is 0 because (0 - 1) is a big number for unsigned integer */ - if(dset->shared->curr_dims[u] == 0) - rdcc->scaled_dims[u] = 0; - else - rdcc->scaled_dims[u] = ((dset->shared->curr_dims[u] - 1) / dset->shared->layout.u.chunk.dim[u]) + 1; + /* Round up to the next integer # of chunks, to accommodate partial chunks */ + rdcc->scaled_dims[u] = (dset->shared->curr_dims[u] + dset->shared->layout.u.chunk.dim[u] - 1) / + dset->shared->layout.u.chunk.dim[u]; if( !(scaled_power2up = H5VM_power2up(rdcc->scaled_dims[u])) ) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2") |