diff options
Diffstat (limited to 'src/H5VM.c')
-rw-r--r-- | src/H5VM.c | 97 |
1 files changed, 39 insertions, 58 deletions
@@ -386,55 +386,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5VM_hyper_disjointp - * - * Purpose: Determines if two hyperslabs are disjoint. - * - * Return: Success: FALSE if they are not disjoint. - * TRUE if they are disjoint. - * - * Failure: A hyperslab of zero size is disjoint from all - * other hyperslabs. - * - * Programmer: Robb Matzke - * Thursday, October 16, 1997 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -htri_t -H5VM_hyper_disjointp(unsigned n, - const hsize_t *offset1, const uint32_t *size1, - const hsize_t *offset2, const uint32_t *size2) -{ - unsigned u; - htri_t ret_value = FALSE; /* Return value */ - - /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - if(!n || !size1 || !size2) - HGOTO_DONE(TRUE) - - for(u = 0; u < n; u++) { - HDcompile_assert(sizeof(uint32_t) <= sizeof(hsize_t)); - - if(0 == size1[u] || 0 == size2[u]) - HGOTO_DONE(TRUE) - if(((offset1 ? offset1[u] : 0) < (offset2 ? offset2[u] : 0) && - ((offset1 ? offset1[u] : 0) + size1[u] <= (offset2 ? offset2[u] : 0))) || - ((offset2 ? offset2[u] : 0) < (offset1 ? offset1[u] : 0) && - ((offset2 ? offset2[u] : 0) + size2[u] <= (offset1 ? offset1[u] : 0)))) - HGOTO_DONE(TRUE) - } /* end for */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VM_hyper_disjointp() */ - - -/*------------------------------------------------------------------------- * Function: H5VM_hyper_fill * * Purpose: Similar to memset() except it operates on hyperslabs... @@ -1068,17 +1019,12 @@ H5VM_array_down(unsigned n, const hsize_t *total_size, hsize_t *down) * Programmer: Quincey Koziol * Tuesday, June 22, 1999 * - * Modifications: - * Use precomputed accumulator array - * Quincey Koziol - * Saturday, April 26, 2003 - * *------------------------------------------------------------------------- */ hsize_t H5VM_array_offset_pre(unsigned n, const hsize_t *acc, const hsize_t *offset) { - int i; /*counter */ + unsigned u; /* Local index variable */ hsize_t ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1088,8 +1034,8 @@ H5VM_array_offset_pre(unsigned n, const hsize_t *acc, const hsize_t *offset) HDassert(offset); /* Compute offset in array */ - for(i = (int)(n - 1), ret_value = 0; i >= 0; --i) - ret_value += acc[i] * offset[i]; + for(u = 0, ret_value = 0; u < n; u++) + ret_value += acc[u] * offset[u]; FUNC_LEAVE_NOAPI(ret_value) } /* end H5VM_array_offset_pre() */ @@ -1157,7 +1103,7 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5VM_array_calc_pre(hsize_t offset, unsigned n, const hsize_t *down, hsize_t *coords) { @@ -1288,6 +1234,41 @@ H5VM_chunk_index(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, /*------------------------------------------------------------------------- + * Function: H5VM_chunk_scaled + * + * Purpose: Compute the scaled coordinates for a chunk offset + * + * Return: <none> + * + * Programmer: Quincey Koziol + * Wednesday, November 19, 2014 + * + *------------------------------------------------------------------------- + */ +void +H5VM_chunk_scaled(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, + hsize_t *scaled) +{ + unsigned u; /* Local index variable */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity check */ + HDassert(ndims <= H5VM_HYPER_NDIMS); + HDassert(coord); + HDassert(chunk); + HDassert(scaled); + + /* Compute the scaled coordinates for actual coordinates */ + /* (Note that the 'scaled' array is an 'OUT' parameter) */ + for(u = 0; u < ndims; u++) + scaled[u] = coord[u] / chunk[u]; + + FUNC_LEAVE_NOAPI_VOID +} /* end H5VM_chunk_scaled() */ + + +/*------------------------------------------------------------------------- * Function: H5VM_chunk_index_scaled * * Purpose: Given a coordinate offset (COORD), the size of each chunk |