From 863ff882b619e8d2c3ad3bdb659f14fa2e9d07d3 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Thu, 13 Feb 2014 17:12:46 -0500 Subject: [svn-r24709] rename H5V to H5VM since H5V is needed in the fastforward project for view objects. The addition of view objects in the fastforward project is expected to be brough into the trunk sometimes in the future, which is why we need to make this change. Tested Manually on Jam and Ostrich. Tested with h5commitest - Koala with intel compilers failed, but nothing had to do with those changes. error on Koala: error while loading shared libraries: libirng.so --- CMakeLists.txt | 2 +- MANIFEST | 4 +- config/cmake/ConfigureChecks.cmake | 2 +- config/irix6.x | 2 +- configure | 2 +- configure.ac | 2 +- src/CMakeLists.txt | 12 +- src/H5B2hdr.c | 6 +- src/H5B2int.c | 4 +- src/H5Dbtree.c | 14 +- src/H5Dchunk.c | 32 +- src/H5Dcompact.c | 6 +- src/H5Dcontig.c | 34 +- src/H5Defl.c | 18 +- src/H5Dfill.c | 8 +- src/H5Dmpio.c | 2 +- src/H5EA.c | 8 +- src/H5EAcache.c | 2 +- src/H5EAdblkpage.c | 2 +- src/H5EAdblock.c | 4 +- src/H5EAhdr.c | 8 +- src/H5EAiblock.c | 6 +- src/H5EApkg.h | 2 +- src/H5EAsblock.c | 4 +- src/H5EAtest.c | 4 +- src/H5FA.c | 8 +- src/H5FAcache.c | 2 +- src/H5FAdbg.c | 4 +- src/H5FAtest.c | 4 +- src/H5FScache.c | 6 +- src/H5FSsection.c | 16 +- src/H5Faccum.c | 12 +- src/H5Fprivate.h | 4 +- src/H5HFcache.c | 2 +- src/H5HFdbg.c | 8 +- src/H5HFdblock.c | 6 +- src/H5HFdtable.c | 14 +- src/H5HFhdr.c | 8 +- src/H5HFiblock.c | 12 +- src/H5HFiter.c | 4 +- src/H5HFman.c | 2 +- src/H5HFpkg.h | 2 +- src/H5HFsection.c | 2 +- src/H5MF.c | 4 +- src/H5Odtype.c | 8 +- src/H5Pdcpl.c | 20 +- src/H5Pdxpl.c | 4 +- src/H5Pencdec.c | 4 +- src/H5Pfapl.c | 20 +- src/H5Plapl.c | 2 +- src/H5Pocpl.c | 8 +- src/H5Sall.c | 4 +- src/H5Shyper.c | 10 +- src/H5Smpio.c | 4 +- src/H5Snone.c | 2 +- src/H5Spoint.c | 6 +- src/H5Sselect.c | 8 +- src/H5V.c | 1712 ------------------------------------ src/H5VM.c | 1712 ++++++++++++++++++++++++++++++++++++ src/H5VMprivate.h | 501 +++++++++++ src/H5Vprivate.h | 501 ----------- src/H5Ztrans.c | 4 +- src/Makefile.am | 2 +- src/Makefile.in | 6 +- src/hdf5.lnt | 8 +- test/earray.c | 18 +- test/farray.c | 2 +- test/fheap.c | 8 +- test/freespace.c | 2 +- test/hyperslab.c | 38 +- test/istore.c | 8 +- test/mf.c | 2 +- testpar/t_prop.c | 45 +- 73 files changed, 2487 insertions(+), 2492 deletions(-) delete mode 100644 src/H5V.c create mode 100644 src/H5VM.c create mode 100644 src/H5VMprivate.h delete mode 100644 src/H5Vprivate.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 73d6d8e..36fe47c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -391,7 +391,7 @@ ENDIF (MAKE_SYSTEM) IF (CMAKE_BUILD_TYPE MATCHES Debug) ADD_DEFINITIONS (-DDEBUG) ADD_DEFINITIONS ( - -DH5Z_DEBUG -DH5V_DEBUG -DH5T_DEBUG + -DH5Z_DEBUG -DH5VM_DEBUG -DH5T_DEBUG -DH5S_DEBUG -DH5P_DEBUG -DH5O_DEBUG -DH5MM_DEBUG -DH5MF_DEBUG -DH5I_DEBUG -DH5HL_DEBUG -DH5HG_DEBUG -DH5G_DEBUG -DH5F_DEBUG -DH5E_DEBUG -DH5D_DEBUG -DH5B_DEBUG -DH5AC_DEBUG -UNDEBUG diff --git a/MANIFEST b/MANIFEST index 91e088d..8c74b28 100644 --- a/MANIFEST +++ b/MANIFEST @@ -921,8 +921,8 @@ ./src/H5Tvlen.c ./src/H5TS.c ./src/H5TSprivate.h -./src/H5V.c -./src/H5Vprivate.h +./src/H5VM.c +./src/H5VMprivate.h ./src/H5WB.c ./src/H5WBprivate.h ./src/H5Z.c diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 48bff74..f92bd0d 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -1186,7 +1186,7 @@ H5ConversionTests (H5_LDOUBLE_TO_LLONG_ACCURATE "Checking IF correctly convertin H5ConversionTests (H5_LLONG_TO_LDOUBLE_CORRECT "Checking IF correctly converting (unsigned) long long to long double values") # ---------------------------------------------------------------------- # Set the flag to indicate that the machine generates bad code -# for the H5V_log2_gen() routine in src/H5Vprivate.h +# for the H5VM_log2_gen() routine in src/H5VMprivate.h # (This flag should be set to no for all machines, except for SGI IRIX64, # where the cache value is set to yes in it's config file) # diff --git a/config/irix6.x b/config/irix6.x index 8179b86..8907a66 100644 --- a/config/irix6.x +++ b/config/irix6.x @@ -171,7 +171,7 @@ hdf5_cv_ulong_to_fp_bottom_bit_accurate=${hdf5_cv_ulong_to_fp_bottom_bit_accurat hdf5_cv_ldouble_to_integer_accurate=${hdf5_cv_ldouble_to_integer_accurate='no'} hdf5_cv_integer_to_ldouble_accurate=${hdf5_cv_integer_to_ldouble_accurate='no'} -# Set flag to generate alternate code for H5V_log2_gen, to avoid +# Set flag to generate alternate code for H5VM_log2_gen, to avoid # problems with the MIPSpro compiler 7.30 and IRIX64 6.5 (ie. other # combinations might work, but haven't been tested) # (9/15/06 - QAK) diff --git a/configure b/configure index 81b48c5..6ec8850 100755 --- a/configure +++ b/configure @@ -30719,7 +30719,7 @@ fi ## ---------------------------------------------------------------------- ## Set the flag to indicate that the machine generates bad code -## for the H5V_log2_gen() routine in src/H5Vprivate.h +## for the H5VM_log2_gen() routine in src/H5VMprivate.h ## (This flag should be set to no for all machines, except for SGI IRIX64, ## where the cache value is set to yes in it's config file) ## diff --git a/configure.ac b/configure.ac index 77020b1..bd41dba 100644 --- a/configure.ac +++ b/configure.ac @@ -4020,7 +4020,7 @@ fi ## ---------------------------------------------------------------------- ## Set the flag to indicate that the machine generates bad code -## for the H5V_log2_gen() routine in src/H5Vprivate.h +## for the H5VM_log2_gen() routine in src/H5VMprivate.h ## (This flag should be set to no for all machines, except for SGI IRIX64, ## where the cache value is set to yes in it's config file) ## diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f71b8b6..c626065 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -604,12 +604,12 @@ SET (H5TS_HDRS IDE_GENERATED_PROPERTIES ("H5TS" "${H5TS_HDRS}" "${H5TS_SRCS}" ) -SET (H5V_SRCS - ${HDF5_SRC_DIR}/H5V.c +SET (H5VM_SRCS + ${HDF5_SRC_DIR}/H5VM.c ) -SET (H5V_HDRS +SET (H5VM_HDRS ) -IDE_GENERATED_PROPERTIES ("H5V" "${H5V_HDRS}" "${H5V_SRCS}" ) +IDE_GENERATED_PROPERTIES ("H5VM" "${H5VM_HDRS}" "${H5VM_SRCS}" ) SET (H5WB_SRCS @@ -681,7 +681,7 @@ SET (common_SRCS ${H5ST_SRCS} ${H5T_SRCS} ${H5TS_SRCS} - ${H5V_SRCS} + ${H5VM_SRCS} ${H5WB_SRCS} ${H5Z_SRCS} ) @@ -760,7 +760,7 @@ SET (H5_PRIVATE_HEADERS ${HDF5_SRC_DIR}/H5STprivate.h ${HDF5_SRC_DIR}/H5Tprivate.h ${HDF5_SRC_DIR}/H5TSprivate.h - ${HDF5_SRC_DIR}/H5Vprivate.h + ${HDF5_SRC_DIR}/H5VMprivate.h ${HDF5_SRC_DIR}/H5WBprivate.h ${HDF5_SRC_DIR}/H5Zprivate.h ${HDF5_SRC_DIR}/H5win32defs.h diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c index 2148f1e..443a2e5 100644 --- a/src/H5B2hdr.c +++ b/src/H5B2hdr.c @@ -37,7 +37,7 @@ #include "H5B2pkg.h" /* v2 B-trees */ #include "H5Eprivate.h" /* Error handling */ #include "H5MFprivate.h" /* File memory management */ -#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ /* Local Macros */ @@ -181,7 +181,7 @@ HDmemset(hdr->page, 0, hdr->node_size); /* Compute size to store # of records in each node */ /* (uses leaf # of records because its the largest) */ - u_max_nrec_size = H5V_limit_enc_size((uint64_t)hdr->node_info[0].max_nrec); + u_max_nrec_size = H5VM_limit_enc_size((uint64_t)hdr->node_info[0].max_nrec); H5_ASSIGN_OVERFLOW(/* To: */ hdr->max_nrec_size, /* From: */ u_max_nrec_size, /* From: */ unsigned, /* To: */ uint8_t) HDassert(hdr->max_nrec_size <= H5B2_SIZEOF_RECORDS_PER_NODE); @@ -197,7 +197,7 @@ HDmemset(hdr->page, 0, hdr->node_size); hdr->node_info[u].cum_max_nrec = ((hdr->node_info[u].max_nrec + 1) * hdr->node_info[u - 1].cum_max_nrec) + hdr->node_info[u].max_nrec; - u_max_nrec_size = H5V_limit_enc_size((uint64_t)hdr->node_info[u].cum_max_nrec); + u_max_nrec_size = H5VM_limit_enc_size((uint64_t)hdr->node_info[u].cum_max_nrec); H5_ASSIGN_OVERFLOW(/* To: */ hdr->node_info[u].cum_max_nrec_size, /* From: */ u_max_nrec_size, /* From: */ unsigned, /* To: */ uint8_t) if(NULL == (hdr->node_info[u].nat_rec_fac = H5FL_fac_init(hdr->cls->nrec_size * hdr->node_info[u].max_nrec))) diff --git a/src/H5B2int.c b/src/H5B2int.c index 8ea8426..630ff98 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -37,7 +37,7 @@ #include "H5B2pkg.h" /* v2 B-trees */ #include "H5Eprivate.h" /* Error handling */ #include "H5MFprivate.h" /* File memory management */ -#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ /* Local Macros */ @@ -387,7 +387,7 @@ H5B2_split_root(H5B2_hdr_t *hdr, hid_t dxpl_id) hdr->node_info[hdr->depth].merge_nrec = (hdr->node_info[hdr->depth].max_nrec * hdr->merge_percent) / 100; hdr->node_info[hdr->depth].cum_max_nrec = ((hdr->node_info[hdr->depth].max_nrec + 1) * hdr->node_info[hdr->depth - 1].cum_max_nrec) + hdr->node_info[hdr->depth].max_nrec; - u_max_nrec_size = H5V_limit_enc_size((uint64_t)hdr->node_info[hdr->depth].cum_max_nrec); + u_max_nrec_size = H5VM_limit_enc_size((uint64_t)hdr->node_info[hdr->depth].cum_max_nrec); H5_ASSIGN_OVERFLOW(/* To: */ hdr->node_info[hdr->depth].cum_max_nrec_size, /* From: */ u_max_nrec_size, /* From: */ unsigned, /* To: */ uint8_t) if(NULL == (hdr->node_info[hdr->depth].nat_rec_fac = H5FL_fac_init(hdr->cls->nrec_size * hdr->node_info[hdr->depth].max_nrec))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create node native key block factory") diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index 37780e7..039ebdc 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -43,7 +43,7 @@ #include "H5MFprivate.h" /* File space management */ #include "H5Oprivate.h" /* Object headers */ #include "H5Sprivate.h" /* Dataspaces */ -#include "H5Vprivate.h" /* Vector and array functions */ +#include "H5VMprivate.h" /* Vector and array functions */ /****************/ /* Local Macros */ @@ -345,7 +345,7 @@ H5D__btree_cmp2(void *_lt_key, void *_udata, void *_rt_key) HDassert(udata->layout->ndims > 0 && udata->layout->ndims <= H5O_LAYOUT_NDIMS); /* Compare the offsets but ignore the other fields */ - ret_value = H5V_vector_cmp_u(udata->layout->ndims, lt_key->offset, rt_key->offset); + ret_value = H5VM_vector_cmp_u(udata->layout->ndims, lt_key->offset, rt_key->offset); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__btree_cmp2() */ @@ -409,9 +409,9 @@ H5D__btree_cmp3(void *_lt_key, void *_udata, void *_rt_key) ret_value = (-1); } /* end if */ else { - if(H5V_vector_ge_u(udata->layout->ndims, udata->offset, rt_key->offset)) + if(H5VM_vector_ge_u(udata->layout->ndims, udata->offset, rt_key->offset)) ret_value = 1; - else if(H5V_vector_lt_u(udata->layout->ndims, udata->offset, lt_key->offset)) + else if(H5VM_vector_lt_u(udata->layout->ndims, udata->offset, lt_key->offset)) ret_value = (-1); } /* end else */ @@ -540,7 +540,7 @@ H5D__btree_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, /* Negative indices not supported yet */ HGOTO_ERROR(H5E_STORAGE, H5E_UNSUPPORTED, H5B_INS_ERROR, "internal error") - } else if(H5V_vector_eq_u(udata->common.layout->ndims, + } else if(H5VM_vector_eq_u(udata->common.layout->ndims, udata->common.offset, lt_key->offset) && lt_key->nbytes > 0) { /* @@ -579,10 +579,10 @@ H5D__btree_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, ret_value = H5B_INS_NOOP; } - } else if (H5V_hyper_disjointp(udata->common.layout->ndims, + } else if (H5VM_hyper_disjointp(udata->common.layout->ndims, lt_key->offset, udata->common.layout->dim, udata->common.offset, udata->common.layout->dim)) { - HDassert(H5V_hyper_disjointp(udata->common.layout->ndims, + HDassert(H5VM_hyper_disjointp(udata->common.layout->ndims, rt_key->offset, udata->common.layout->dim, udata->common.offset, udata->common.layout->dim)); /* diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index db195ca..e834aa3 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -59,7 +59,7 @@ #include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ -#include "H5Vprivate.h" /* Vector and array functions */ +#include "H5VMprivate.h" /* Vector and array functions */ /****************/ @@ -324,7 +324,7 @@ H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, hsiz HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get simple dataspace info") /* Calculate the index of this chunk */ - if(H5V_chunk_index((unsigned)space_ndims, offset, + if(H5VM_chunk_index((unsigned)space_ndims, offset, layout->u.chunk.dim, layout->u.chunk.down_chunks, &chunk_idx) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't get chunk index") @@ -419,7 +419,7 @@ H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, const hsize } /* end for */ /* Get the "down" sizes for each dimension */ - if(H5V_array_down(ndims, layout->chunks, layout->down_chunks) < 0) + if(H5VM_array_down(ndims, layout->chunks, layout->down_chunks) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute 'down' chunk size value") done: @@ -1137,7 +1137,7 @@ H5D__create_chunk_map_single(H5D_chunk_map_t *fm, const H5D_io_info_t chunk_info->coords[fm->f_ndims] = 0; /* Calculate the index of this chunk */ - if(H5V_chunk_index(fm->f_ndims, chunk_info->coords, fm->layout->u.chunk.dim, fm->layout->u.chunk.down_chunks, &chunk_info->index) < 0) + if(H5VM_chunk_index(fm->f_ndims, chunk_info->coords, fm->layout->u.chunk.dim, fm->layout->u.chunk.down_chunks, &chunk_info->index) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") /* Copy selection for file's dataspace into chunk dataspace */ @@ -1222,7 +1222,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t } /* end for */ /* Calculate the index of this chunk */ - if(H5V_chunk_index(fm->f_ndims, coords, fm->layout->u.chunk.dim, fm->layout->u.chunk.down_chunks, &chunk_index) < 0) + if(H5VM_chunk_index(fm->f_ndims, coords, fm->layout->u.chunk.dim, fm->layout->u.chunk.down_chunks, &chunk_index) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") /* Iterate through each chunk in the dataset */ @@ -1340,7 +1340,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t } while(coords[curr_dim] > sel_end[curr_dim]); /* Re-calculate the index of this chunk */ - if(H5V_chunk_index(fm->f_ndims, coords, fm->layout->u.chunk.dim, fm->layout->u.chunk.down_chunks, &chunk_index) < 0) + if(H5VM_chunk_index(fm->f_ndims, coords, fm->layout->u.chunk.dim, fm->layout->u.chunk.down_chunks, &chunk_index) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") } /* end if */ } /* end while */ @@ -1488,7 +1488,7 @@ H5D__chunk_file_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, cons FUNC_ENTER_STATIC /* Calculate the index of this chunk */ - if(H5V_chunk_index(ndims, coords, fm->layout->u.chunk.dim, fm->layout->u.chunk.down_chunks, &chunk_index) < 0) + if(H5VM_chunk_index(ndims, coords, fm->layout->u.chunk.dim, fm->layout->u.chunk.down_chunks, &chunk_index) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") /* Find correct chunk in file & memory skip list */ @@ -1600,7 +1600,7 @@ H5D__chunk_mem_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const FUNC_ENTER_STATIC /* Calculate the index of this chunk */ - if(H5V_chunk_index(ndims, coords, fm->layout->u.chunk.dim, fm->layout->u.chunk.down_chunks, &chunk_index) < 0) + if(H5VM_chunk_index(ndims, coords, fm->layout->u.chunk.dim, fm->layout->u.chunk.down_chunks, &chunk_index) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") /* Find correct chunk in file & memory skip list */ @@ -3412,7 +3412,7 @@ H5D__chunk_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, hsize_t chunk_idx; /* Calculate the index of this chunk */ - if(H5V_chunk_index((unsigned)space_ndims, chunk_offset, + if(H5VM_chunk_index((unsigned)space_ndims, chunk_offset, layout->u.chunk.dim, layout->u.chunk.down_chunks, &chunk_idx) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't get chunk index") @@ -3986,7 +3986,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) while(!carry) { /* Calculate the index of this chunk */ - if(H5V_chunk_index((unsigned)space_ndims, chunk_offset, + if(H5VM_chunk_index((unsigned)space_ndims, chunk_offset, layout->u.chunk.dim, layout->u.chunk.down_chunks, &(chk_io_info.store->chunk.index)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't get chunk index") @@ -4127,7 +4127,7 @@ H5D__chunk_addrmap_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) FUNC_ENTER_STATIC /* Compute the index for this chunk */ - if(H5V_chunk_index(rank, chunk_rec->offset, udata->common.layout->dim, udata->common.layout->down_chunks, &chunk_index) < 0) + if(H5VM_chunk_index(rank, chunk_rec->offset, udata->common.layout->dim, udata->common.layout->down_chunks, &chunk_index) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, H5_ITER_ERROR, "can't get chunk index") /* Set it in the userdata to return */ @@ -4318,7 +4318,7 @@ H5D__chunk_update_cache(H5D_t *dset, hid_t dxpl_id) next = ent->next; /* Calculate the index of this chunk */ - if(H5V_chunk_index(rank, ent->offset, dset->shared->layout.u.chunk.dim, dset->shared->layout.u.chunk.down_chunks, &idx) < 0) + if(H5VM_chunk_index(rank, ent->offset, dset->shared->layout.u.chunk.dim, dset->shared->layout.u.chunk.down_chunks, &idx) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") /* Compute the index for the chunk entry */ @@ -5087,7 +5087,7 @@ static herr_t H5D__nonexistent_readvv_cb(hsize_t UNUSED dst_off, hsize_t src_off, size_t len, void *_udata) { - H5D_chunk_readvv_ud_t *udata = (H5D_chunk_readvv_ud_t *)_udata; /* User data for H5V_opvv() operator */ + H5D_chunk_readvv_ud_t *udata = (H5D_chunk_readvv_ud_t *)_udata; /* User data for H5VM_opvv() operator */ H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */ hbool_t fb_info_init = FALSE; /* Whether the fill value buffer has been initialized */ herr_t ret_value = SUCCEED; /* Return value */ @@ -5139,7 +5139,7 @@ H5D__nonexistent_readvv(const H5D_io_info_t *io_info, size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_off_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[]) { - H5D_chunk_readvv_ud_t udata; /* User data for H5V_opvv() operator */ + H5D_chunk_readvv_ud_t udata; /* User data for H5VM_opvv() operator */ ssize_t ret_value; /* Return value */ FUNC_ENTER_STATIC @@ -5153,13 +5153,13 @@ H5D__nonexistent_readvv(const H5D_io_info_t *io_info, HDassert(mem_len_arr); HDassert(mem_off_arr); - /* Set up user data for H5V_opvv() */ + /* Set up user data for H5VM_opvv() */ udata.rbuf = (unsigned char *)io_info->u.rbuf; udata.dset = io_info->dset; udata.dxpl_id = io_info->dxpl_id; /* Call generic sequence operation routine */ - if((ret_value = H5V_opvv(chunk_max_nseq, chunk_curr_seq, chunk_len_arr, chunk_off_arr, + if((ret_value = H5VM_opvv(chunk_max_nseq, chunk_curr_seq, chunk_len_arr, chunk_off_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_off_arr, H5D__nonexistent_readvv_cb, &udata)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized fill value init") diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index c692c2b..0b34c07 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -40,7 +40,7 @@ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Oprivate.h" /* Object headers */ -#include "H5Vprivate.h" /* Vector and array functions */ +#include "H5VMprivate.h" /* Vector and array functions */ /****************/ @@ -297,7 +297,7 @@ H5D__compact_readvv(const H5D_io_info_t *io_info, HDassert(io_info); /* Use the vectorized memory copy routine to do actual work */ - if((ret_value = H5V_memcpyvv(io_info->u.rbuf, mem_max_nseq, mem_curr_seq, mem_size_arr, mem_offset_arr, io_info->store->compact.buf, dset_max_nseq, dset_curr_seq, dset_size_arr, dset_offset_arr)) < 0) + if((ret_value = H5VM_memcpyvv(io_info->u.rbuf, mem_max_nseq, mem_curr_seq, mem_size_arr, mem_offset_arr, io_info->store->compact.buf, dset_max_nseq, dset_curr_seq, dset_size_arr, dset_offset_arr)) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed") done: @@ -338,7 +338,7 @@ H5D__compact_writevv(const H5D_io_info_t *io_info, HDassert(io_info); /* Use the vectorized memory copy routine to do actual work */ - if((ret_value = H5V_memcpyvv(io_info->store->compact.buf, dset_max_nseq, dset_curr_seq, dset_size_arr, dset_offset_arr, io_info->u.wbuf, mem_max_nseq, mem_curr_seq, mem_size_arr, mem_offset_arr)) < 0) + if((ret_value = H5VM_memcpyvv(io_info->store->compact.buf, dset_max_nseq, dset_curr_seq, dset_size_arr, dset_offset_arr, io_info->u.wbuf, mem_max_nseq, mem_curr_seq, mem_size_arr, mem_offset_arr)) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed") /* Mark the compact dataset's buffer as dirty */ diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index acc7124..69db7d4 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -43,7 +43,7 @@ #include "H5MFprivate.h" /* File memory management */ #include "H5Oprivate.h" /* Object headers */ #include "H5Pprivate.h" /* Property lists */ -#include "H5Vprivate.h" /* Vector and array functions */ +#include "H5VMprivate.h" /* Vector and array functions */ /****************/ @@ -638,7 +638,7 @@ static herr_t H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata) { - H5D_contig_readvv_sieve_ud_t *udata = (H5D_contig_readvv_sieve_ud_t *)_udata; /* User data for H5V_opvv() operator */ + H5D_contig_readvv_sieve_ud_t *udata = (H5D_contig_readvv_sieve_ud_t *)_udata; /* User data for H5VM_opvv() operator */ H5F_t *file = udata->file; /* File for dataset */ H5D_rdcdc_t *dset_contig = udata->dset_contig; /* Cached information about contiguous data */ const H5D_contig_storage_t *store_contig = udata->store_contig; /* Contiguous storage info for this I/O operation */ @@ -804,7 +804,7 @@ done: static herr_t H5D__contig_readvv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata) { - H5D_contig_readvv_ud_t *udata = (H5D_contig_readvv_ud_t *)_udata; /* User data for H5V_opvv() operator */ + H5D_contig_readvv_ud_t *udata = (H5D_contig_readvv_ud_t *)_udata; /* User data for H5VM_opvv() operator */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -857,9 +857,9 @@ H5D__contig_readvv(const H5D_io_info_t *io_info, /* Check if data sieving is enabled */ if(H5F_HAS_FEATURE(io_info->dset->oloc.file, H5FD_FEAT_DATA_SIEVE)) { - H5D_contig_readvv_sieve_ud_t udata; /* User data for H5V_opvv() operator */ + H5D_contig_readvv_sieve_ud_t udata; /* User data for H5VM_opvv() operator */ - /* Set up user data for H5V_opvv() */ + /* Set up user data for H5VM_opvv() */ udata.file = io_info->dset->oloc.file; udata.dset_contig = &(io_info->dset->shared->cache.contig); udata.store_contig = &(io_info->store->contig); @@ -867,22 +867,22 @@ H5D__contig_readvv(const H5D_io_info_t *io_info, udata.dxpl_id = io_info->dxpl_id; /* Call generic sequence operation routine */ - if((ret_value = H5V_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr, + if((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_off_arr, H5D__contig_readvv_sieve_cb, &udata)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized sieve buffer read") } /* end if */ else { - H5D_contig_readvv_ud_t udata; /* User data for H5V_opvv() operator */ + H5D_contig_readvv_ud_t udata; /* User data for H5VM_opvv() operator */ - /* Set up user data for H5V_opvv() */ + /* Set up user data for H5VM_opvv() */ udata.file = io_info->dset->oloc.file; udata.dset_addr = io_info->store->contig.dset_addr; udata.rbuf = (unsigned char *)io_info->u.rbuf; udata.dxpl_id = io_info->dxpl_id; /* Call generic sequence operation routine */ - if((ret_value = H5V_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr, + if((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_off_arr, H5D__contig_readvv_cb, &udata)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized read") @@ -909,7 +909,7 @@ static herr_t H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata) { - H5D_contig_writevv_sieve_ud_t *udata = (H5D_contig_writevv_sieve_ud_t *)_udata; /* User data for H5V_opvv() operator */ + H5D_contig_writevv_sieve_ud_t *udata = (H5D_contig_writevv_sieve_ud_t *)_udata; /* User data for H5VM_opvv() operator */ H5F_t *file = udata->file; /* File for dataset */ H5D_rdcdc_t *dset_contig = udata->dset_contig; /* Cached information about contiguous data */ const H5D_contig_storage_t *store_contig = udata->store_contig; /* Contiguous storage info for this I/O operation */ @@ -1126,7 +1126,7 @@ done: static herr_t H5D__contig_writevv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata) { - H5D_contig_writevv_ud_t *udata = (H5D_contig_writevv_ud_t *)_udata; /* User data for H5V_opvv() operator */ + H5D_contig_writevv_ud_t *udata = (H5D_contig_writevv_ud_t *)_udata; /* User data for H5VM_opvv() operator */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1178,9 +1178,9 @@ H5D__contig_writevv(const H5D_io_info_t *io_info, /* Check if data sieving is enabled */ if(H5F_HAS_FEATURE(io_info->dset->oloc.file, H5FD_FEAT_DATA_SIEVE)) { - H5D_contig_writevv_sieve_ud_t udata; /* User data for H5V_opvv() operator */ + H5D_contig_writevv_sieve_ud_t udata; /* User data for H5VM_opvv() operator */ - /* Set up user data for H5V_opvv() */ + /* Set up user data for H5VM_opvv() */ udata.file = io_info->dset->oloc.file; udata.dset_contig = &(io_info->dset->shared->cache.contig); udata.store_contig = &(io_info->store->contig); @@ -1188,22 +1188,22 @@ H5D__contig_writevv(const H5D_io_info_t *io_info, udata.dxpl_id = io_info->dxpl_id; /* Call generic sequence operation routine */ - if((ret_value = H5V_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr, + if((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_off_arr, H5D__contig_writevv_sieve_cb, &udata)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized sieve buffer write") } /* end if */ else { - H5D_contig_writevv_ud_t udata; /* User data for H5V_opvv() operator */ + H5D_contig_writevv_ud_t udata; /* User data for H5VM_opvv() operator */ - /* Set up user data for H5V_opvv() */ + /* Set up user data for H5VM_opvv() */ udata.file = io_info->dset->oloc.file; udata.dset_addr = io_info->store->contig.dset_addr; udata.wbuf = (const unsigned char *)io_info->u.wbuf; udata.dxpl_id = io_info->dxpl_id; /* Call generic sequence operation routine */ - if((ret_value = H5V_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr, + if((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_off_arr, H5D__contig_writevv_cb, &udata)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized read") diff --git a/src/H5Defl.c b/src/H5Defl.c index c5cf8e2..38c8ccd 100644 --- a/src/H5Defl.c +++ b/src/H5Defl.c @@ -33,7 +33,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* Files */ #include "H5HLprivate.h" /* Local Heaps */ -#include "H5Vprivate.h" /* Vector and array functions */ +#include "H5VMprivate.h" /* Vector and array functions */ /****************/ @@ -425,7 +425,7 @@ done: static herr_t H5D__efl_readvv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata) { - H5D_efl_readvv_ud_t *udata = (H5D_efl_readvv_ud_t *)_udata; /* User data for H5V_opvv() operator */ + H5D_efl_readvv_ud_t *udata = (H5D_efl_readvv_ud_t *)_udata; /* User data for H5VM_opvv() operator */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -459,7 +459,7 @@ H5D__efl_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_off_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[]) { - H5D_efl_readvv_ud_t udata; /* User data for H5V_opvv() operator */ + H5D_efl_readvv_ud_t udata; /* User data for H5VM_opvv() operator */ ssize_t ret_value; /* Return value (Total size of sequence in bytes) */ FUNC_ENTER_STATIC @@ -475,12 +475,12 @@ H5D__efl_readvv(const H5D_io_info_t *io_info, HDassert(mem_len_arr); HDassert(mem_off_arr); - /* Set up user data for H5V_opvv() */ + /* Set up user data for H5VM_opvv() */ udata.efl = &(io_info->store->efl); udata.rbuf = (unsigned char *)io_info->u.rbuf; /* Call generic sequence operation routine */ - if((ret_value = H5V_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr, + if((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_off_arr, H5D__efl_readvv_cb, &udata)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized EFL read") @@ -505,7 +505,7 @@ done: static herr_t H5D__efl_writevv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata) { - H5D_efl_writevv_ud_t *udata = (H5D_efl_writevv_ud_t *)_udata; /* User data for H5V_opvv() operator */ + H5D_efl_writevv_ud_t *udata = (H5D_efl_writevv_ud_t *)_udata; /* User data for H5VM_opvv() operator */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -539,7 +539,7 @@ H5D__efl_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_off_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[]) { - H5D_efl_writevv_ud_t udata; /* User data for H5V_opvv() operator */ + H5D_efl_writevv_ud_t udata; /* User data for H5VM_opvv() operator */ ssize_t ret_value; /* Return value (Total size of sequence in bytes) */ FUNC_ENTER_STATIC @@ -555,12 +555,12 @@ H5D__efl_writevv(const H5D_io_info_t *io_info, HDassert(mem_len_arr); HDassert(mem_off_arr); - /* Set up user data for H5V_opvv() */ + /* Set up user data for H5VM_opvv() */ udata.efl = &(io_info->store->efl); udata.wbuf = (const unsigned char *)io_info->u.wbuf; /* Call generic sequence operation routine */ - if((ret_value = H5V_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr, + if((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_off_arr, H5D__efl_writevv_cb, &udata)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized EFL write") diff --git a/src/H5Dfill.c b/src/H5Dfill.c index 2edb363..e682dd6 100644 --- a/src/H5Dfill.c +++ b/src/H5Dfill.c @@ -38,7 +38,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* IDs */ -#include "H5Vprivate.h" /* Vector and array functions */ +#include "H5VMprivate.h" /* Vector and array functions */ #include "H5WBprivate.h" /* Wrapped Buffers */ @@ -262,7 +262,7 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf, HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Replicate the file's fill value into the temporary buffer */ - H5V_array_fill(tmp_buf, fill, src_type_size, (size_t)nelmts); + H5VM_array_fill(tmp_buf, fill, src_type_size, (size_t)nelmts); /* Convert from file's fill value into memory form */ if(H5T_convert(tpath, src_id, dst_id, (size_t)nelmts, (size_t)0, (size_t)0, tmp_buf, bkg_buf, dxpl_id) < 0) @@ -494,7 +494,7 @@ H5D__fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf, } /* end else */ /* Replicate the fill value into the cached buffer */ - H5V_array_fill(fb_info->fill_buf, fill->buf, fb_info->max_elmt_size, fb_info->elmts_per_buf); + H5VM_array_fill(fb_info->fill_buf, fill->buf, fb_info->max_elmt_size, fb_info->elmts_per_buf); } /* end else */ } /* end if */ else { /* Fill the buffer with the default fill value */ @@ -588,7 +588,7 @@ H5D__fill_refill_vl(H5D_fill_buf_info_t *fb_info, size_t nelmts, hid_t dxpl_id) /* Replicate the fill value into the cached buffer */ if(nelmts > 1) - H5V_array_fill((void *)((unsigned char *)fb_info->fill_buf + fb_info->mem_elmt_size), fb_info->fill_buf, fb_info->mem_elmt_size, (nelmts - 1)); + H5VM_array_fill((void *)((unsigned char *)fb_info->fill_buf + fb_info->mem_elmt_size), fb_info->fill_buf, fb_info->mem_elmt_size, (nelmts - 1)); /* Reset the entire background buffer, if necessary */ if(H5T_path_bkg(fb_info->mem_to_dset_tpath)) diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 4d4c2bf..3b5bb30 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -43,7 +43,7 @@ #include "H5Oprivate.h" /* Object headers */ #include "H5Pprivate.h" /* Property lists */ #include "H5Sprivate.h" /* Dataspaces */ -#include "H5Vprivate.h" /* Vector */ +#include "H5VMprivate.h" /* Vector */ #ifdef H5_HAVE_PARALLEL diff --git a/src/H5EA.c b/src/H5EA.c index 1679f89..c967517 100644 --- a/src/H5EA.c +++ b/src/H5EA.c @@ -48,7 +48,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5EApkg.h" /* Extensible Arrays */ #include "H5FLprivate.h" /* Free Lists */ -#include "H5Vprivate.h" /* Vector functions */ +#include "H5VMprivate.h" /* Vector functions */ /****************/ @@ -560,13 +560,13 @@ if(sblock->dblk_npages) HDfprintf(stderr, "%s: sblock->addr = %a\n", FUNC, sblock->addr); HDfprintf(stderr, "%s: sblock->dblk_addrs[%Zu] = %a\n", FUNC, dblk_idx, sblock->dblk_addrs[dblk_idx]); HDfprintf(stderr, "%s: H5EA_DBLOCK_PREFIX_SIZE(sblock) = %u\n", FUNC, (unsigned)H5EA_DBLOCK_PREFIX_SIZE(sblock)); -HDfprintf(stderr, "%s: sblock->page_init[%Zu] = %t\n", FUNC, page_init_idx, H5V_bit_get(sblock->page_init, page_init_idx)); +HDfprintf(stderr, "%s: sblock->page_init[%Zu] = %t\n", FUNC, page_init_idx, H5VM_bit_get(sblock->page_init, page_init_idx)); HDfprintf(stderr, "%s: page_idx = %Zu, elmt_idx = %Hu, dblk_page_addr = %a\n", FUNC, page_idx, elmt_idx, dblk_page_addr); HDfprintf(stderr, "%s: sblock->dblk_page_size = %Zu\n", FUNC, sblock->dblk_page_size); #endif /* QAK */ /* Check if page has been initialized yet */ - if(!H5V_bit_get(sblock->page_init, page_init_idx)) { + if(!H5VM_bit_get(sblock->page_init, page_init_idx)) { /* Check if we are allowed to create the thing */ if(H5AC_WRITE == thing_acc) { /* Create the data block page */ @@ -574,7 +574,7 @@ HDfprintf(stderr, "%s: sblock->dblk_page_size = %Zu\n", FUNC, sblock->dblk_page_ H5E_THROW(H5E_CANTCREATE, "unable to create data block page") /* Mark data block page as initialized in super block */ - H5V_bit_set(sblock->page_init, page_init_idx, TRUE); + H5VM_bit_set(sblock->page_init, page_init_idx, TRUE); sblock_cache_flags |= H5AC__DIRTIED_FLAG; } /* end if */ else diff --git a/src/H5EAcache.c b/src/H5EAcache.c index a178536..1d40283 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -43,7 +43,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5EApkg.h" /* Extensible Arrays */ #include "H5MFprivate.h" /* File memory management */ -#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ #include "H5WBprivate.h" /* Wrapped Buffers */ diff --git a/src/H5EAdblkpage.c b/src/H5EAdblkpage.c index eba7470..3c2da7c 100644 --- a/src/H5EAdblkpage.c +++ b/src/H5EAdblkpage.c @@ -43,7 +43,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5EApkg.h" /* Extensible Arrays */ #include "H5FLprivate.h" /* Free Lists */ -#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ diff --git a/src/H5EAdblock.c b/src/H5EAdblock.c index 640f353..dd1e7b0 100644 --- a/src/H5EAdblock.c +++ b/src/H5EAdblock.c @@ -44,7 +44,7 @@ #include "H5EApkg.h" /* Extensible Arrays */ #include "H5FLprivate.h" /* Free Lists */ #include "H5MFprivate.h" /* File memory management */ -#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ @@ -276,7 +276,7 @@ HDfprintf(stderr, "%s: after adjusting for index block elements, idx = %Hu\n", F #ifdef QAK HDfprintf(stderr, "%s: hdr->cparam.data_blk_min_elmts = %u\n", FUNC, (unsigned)hdr->cparam.data_blk_min_elmts); #endif /* QAK */ - sblk_idx = H5V_log2_gen((uint64_t)((idx / hdr->cparam.data_blk_min_elmts) + 1)); + sblk_idx = H5VM_log2_gen((uint64_t)((idx / hdr->cparam.data_blk_min_elmts) + 1)); #ifdef QAK HDfprintf(stderr, "%s: sblk_idx = %u\n", FUNC, sblk_idx); HDfprintf(stderr, "%s: hdr->sblk_info[%u] = {%Hu, %Zu, %Hu, %Hu}\n", FUNC, sblk_idx, hdr->sblk_info[sblk_idx].ndblks, hdr->sblk_info[sblk_idx].dblk_nelmts, hdr->sblk_info[sblk_idx].start_idx, hdr->sblk_info[sblk_idx].start_dblk); diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c index 08d2fb9..d5f3538 100644 --- a/src/H5EAhdr.c +++ b/src/H5EAhdr.c @@ -43,7 +43,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5EApkg.h" /* Extensible Arrays */ #include "H5MFprivate.h" /* File memory management */ -#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ @@ -201,7 +201,7 @@ H5EA__hdr_init(H5EA_hdr_t *hdr, void *ctx_udata)) HDassert(hdr->cparam.sup_blk_min_data_ptrs); /* Compute general information */ - hdr->nsblks = 1 + (hdr->cparam.max_nelmts_bits - H5V_log2_of2(hdr->cparam.data_blk_min_elmts)); + hdr->nsblks = 1 + (hdr->cparam.max_nelmts_bits - H5VM_log2_of2(hdr->cparam.data_blk_min_elmts)); hdr->dblk_page_nelmts = (size_t)1 << hdr->cparam.max_dblk_page_nelmts_bits; hdr->arr_off_size = (unsigned char)H5EA_SIZEOF_OFFSET_BITS(hdr->cparam.max_nelmts_bits); #ifdef QAK @@ -270,7 +270,7 @@ H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr, size_t nelmts)) /* Compute the index of the element buffer factory */ H5_CHECK_OVERFLOW(nelmts, /*From:*/size_t, /*To:*/uint32_t); - idx = H5V_log2_of2((uint32_t)nelmts) - H5V_log2_of2((uint32_t)hdr->cparam.data_blk_min_elmts); + idx = H5VM_log2_of2((uint32_t)nelmts) - H5VM_log2_of2((uint32_t)hdr->cparam.data_blk_min_elmts); #ifdef QAK HDfprintf(stderr, "%s: nelmts = %Zu, hdr->data_blk_min_elmts = %u, idx = %u\n", FUNC, nelmts, (unsigned)hdr->data_blk_min_elmts, idx); #endif /* QAK */ @@ -340,7 +340,7 @@ H5EA__hdr_free_elmts(H5EA_hdr_t *hdr, size_t nelmts, void *elmts)) /* Compute the index of the element buffer factory */ H5_CHECK_OVERFLOW(nelmts, /*From:*/size_t, /*To:*/uint32_t); - idx = H5V_log2_of2((uint32_t)nelmts) - H5V_log2_of2((uint32_t)hdr->cparam.data_blk_min_elmts); + idx = H5VM_log2_of2((uint32_t)nelmts) - H5VM_log2_of2((uint32_t)hdr->cparam.data_blk_min_elmts); #ifdef QAK HDfprintf(stderr, "%s: nelmts = %Zu, hdr->data_blk_min_elmts = %u, idx = %u\n", FUNC, nelmts, (unsigned)hdr->data_blk_min_elmts, idx); #endif /* QAK */ diff --git a/src/H5EAiblock.c b/src/H5EAiblock.c index e18947a..3c2894a 100644 --- a/src/H5EAiblock.c +++ b/src/H5EAiblock.c @@ -44,7 +44,7 @@ #include "H5EApkg.h" /* Extensible Arrays */ #include "H5FLprivate.h" /* Free Lists */ #include "H5MFprivate.h" /* File memory management */ -#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ @@ -219,7 +219,7 @@ HDfprintf(stderr, "%s: iblock->size = %Zu\n", FUNC, iblock->size); haddr_t tmp_addr = HADDR_UNDEF; /* Address value to fill data block addresses with */ /* Set all the data block addresses to "undefined" address value */ - H5V_array_fill(iblock->dblk_addrs, &tmp_addr, sizeof(haddr_t), iblock->ndblk_addrs); + H5VM_array_fill(iblock->dblk_addrs, &tmp_addr, sizeof(haddr_t), iblock->ndblk_addrs); } /* end if */ /* Reset any super block addresses in the index block */ @@ -227,7 +227,7 @@ HDfprintf(stderr, "%s: iblock->size = %Zu\n", FUNC, iblock->size); haddr_t tmp_addr = HADDR_UNDEF; /* Address value to fill super block addresses with */ /* Set all the super block addresses to "undefined" address value */ - H5V_array_fill(iblock->sblk_addrs, &tmp_addr, sizeof(haddr_t), iblock->nsblk_addrs); + H5VM_array_fill(iblock->sblk_addrs, &tmp_addr, sizeof(haddr_t), iblock->nsblk_addrs); } /* end if */ /* Cache the new extensible array index block */ diff --git a/src/H5EApkg.h b/src/H5EApkg.h index af560b5..fc15e72 100644 --- a/src/H5EApkg.h +++ b/src/H5EApkg.h @@ -148,7 +148,7 @@ #define H5EA_SIZEOF_OFFSET_BITS(b) (((b) + 7) / 8) /* Compute the first super block index that will hold a certain # of data block pointers */ -#define H5EA_SBLK_FIRST_IDX(m) (2 * H5V_log2_of2((uint32_t)m)) +#define H5EA_SBLK_FIRST_IDX(m) (2 * H5VM_log2_of2((uint32_t)m)) /****************************/ /* Package Private Typedefs */ diff --git a/src/H5EAsblock.c b/src/H5EAsblock.c index ba1c40f..1cc8bd9 100644 --- a/src/H5EAsblock.c +++ b/src/H5EAsblock.c @@ -44,7 +44,7 @@ #include "H5EApkg.h" /* Extensible Arrays */ #include "H5FLprivate.h" /* Free Lists */ #include "H5MFprivate.h" /* File memory management */ -#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ @@ -229,7 +229,7 @@ HDfprintf(stderr, "%s: sblock->block_off = %Hu\n", FUNC, sblock->block_off); sblock->addr = sblock_addr; /* Reset data block addresses to "undefined" address value */ - H5V_array_fill(sblock->dblk_addrs, &tmp_addr, sizeof(haddr_t), sblock->ndblks); + H5VM_array_fill(sblock->dblk_addrs, &tmp_addr, sizeof(haddr_t), sblock->ndblks); /* Cache the new extensible array super block */ if(H5AC_insert_entry(hdr->f, dxpl_id, H5AC_EARRAY_SBLOCK, sblock_addr, sblock, H5AC__NO_FLAGS_SET) < 0) diff --git a/src/H5EAtest.c b/src/H5EAtest.c index 0153a1e..94303c3 100644 --- a/src/H5EAtest.c +++ b/src/H5EAtest.c @@ -40,7 +40,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5EApkg.h" /* Extensible Arrays */ #include "H5FLprivate.h" /* Free Lists */ -#include "H5Vprivate.h" /* Vector functions */ +#include "H5VMprivate.h" /* Vector functions */ /****************/ @@ -210,7 +210,7 @@ H5EA__test_fill(void *nat_blk, size_t nelmts)) HDassert(nat_blk); HDassert(nelmts); - H5V_array_fill(nat_blk, &fill_val, sizeof(uint64_t), nelmts); + H5VM_array_fill(nat_blk, &fill_val, sizeof(uint64_t), nelmts); END_FUNC(STATIC) /* end H5EA__test_fill() */ diff --git a/src/H5FA.c b/src/H5FA.c index 2a602a1..128999a 100644 --- a/src/H5FA.c +++ b/src/H5FA.c @@ -43,7 +43,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5FApkg.h" /* Fixed Arrays */ #include "H5FLprivate.h" /* Free Lists */ -#include "H5Vprivate.h" /* Vector functions */ +#include "H5VMprivate.h" /* Vector functions */ /****************/ @@ -389,13 +389,13 @@ HDfprintf(stderr, "%s: fixed array data block address not defined!\n", FUNC, idx dblk_page_nelmts = dblock->dblk_page_nelmts; /* Check if the page has been created yet */ - if(!H5V_bit_get(dblock->dblk_page_init, page_idx)) { + if(!H5VM_bit_get(dblock->dblk_page_init, page_idx)) { /* Create the data block page */ if(H5FA__dblk_page_create(hdr, dxpl_id, dblk_page_addr, dblk_page_nelmts) < 0) H5E_THROW(H5E_CANTCREATE, "unable to create data block page") /* Mark data block page as initialized in data block */ - H5V_bit_set(dblock->dblk_page_init, page_idx, TRUE); + H5VM_bit_set(dblock->dblk_page_init, page_idx, TRUE); dblock_cache_flags |= H5AC__DIRTIED_FLAG; } /* end if */ @@ -481,7 +481,7 @@ HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx); page_idx = (size_t)(idx / dblock->dblk_page_nelmts); /* Check if the page is defined yet */ - if(!H5V_bit_get(dblock->dblk_page_init, page_idx)) { + if(!H5VM_bit_get(dblock->dblk_page_init, page_idx)) { /* Call the class's 'fill' callback */ if((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0) H5E_THROW(H5E_CANTSET, "can't set element to class's fill value") diff --git a/src/H5FAcache.c b/src/H5FAcache.c index 14df4c8..cb156db 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -41,7 +41,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5FApkg.h" /* Fixed Arrays */ #include "H5MFprivate.h" /* File memory management */ -#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ #include "H5WBprivate.h" /* Wrapped Buffers */ diff --git a/src/H5FAdbg.c b/src/H5FAdbg.c index 9bb90af..eb5e32e 100644 --- a/src/H5FAdbg.c +++ b/src/H5FAdbg.c @@ -41,7 +41,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5FApkg.h" /* Fixed Arrays */ #include "H5Oprivate.h" /* Object Header */ -#include "H5Vprivate.h" /* Vector functions */ +#include "H5VMprivate.h" /* Vector functions */ /****************/ @@ -233,7 +233,7 @@ H5FA__dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde /* Read and print each page's elements in the data block */ for(page_idx = 0; page_idx < dblock->npages; page_idx++) { - if(!H5V_bit_get(dblock->dblk_page_init, page_idx)) { + if(!H5VM_bit_get(dblock->dblk_page_init, page_idx)) { HDfprintf(stream, "%*s%-*s %Hu %s\n", indent, "", fwidth, "Page %Zu:", page_idx, "empty"); diff --git a/src/H5FAtest.c b/src/H5FAtest.c index 1828fa4..298c89d 100644 --- a/src/H5FAtest.c +++ b/src/H5FAtest.c @@ -40,7 +40,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5FApkg.h" /* Fixed Arrays */ #include "H5FLprivate.h" /* Free Lists */ -#include "H5Vprivate.h" /* Vector functions */ +#include "H5VMprivate.h" /* Vector functions */ /****************/ @@ -206,7 +206,7 @@ H5FA__test_fill(void *nat_blk, size_t nelmts)) HDassert(nat_blk); HDassert(nelmts); - H5V_array_fill(nat_blk, &fill_val, sizeof(uint64_t), nelmts); + H5VM_array_fill(nat_blk, &fill_val, sizeof(uint64_t), nelmts); END_FUNC(STATIC) /* end H5FA__test_fill() */ diff --git a/src/H5FScache.c b/src/H5FScache.c index e441398..e03a0a4 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -38,7 +38,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5FSpkg.h" /* File free space */ #include "H5MFprivate.h" /* File memory management */ -#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ #include "H5WBprivate.h" /* Wrapped Buffers */ /****************/ @@ -612,7 +612,7 @@ H5FS_cache_sinfo_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata unsigned sect_cnt_size; /* The size of the section size counts */ /* Compute the size of the section counts */ - sect_cnt_size = H5V_limit_enc_size((uint64_t)udata->fspace->serial_sect_count); + sect_cnt_size = H5VM_limit_enc_size((uint64_t)udata->fspace->serial_sect_count); /* Reset the section count, the "add" routine will update it */ old_tot_sect_count = udata->fspace->tot_sect_count; @@ -862,7 +862,7 @@ H5FS_cache_sinfo_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H /* Set up user data for iterator */ udata.sinfo = sinfo; udata.p = &p; - udata.sect_cnt_size = H5V_limit_enc_size((uint64_t)sinfo->fspace->serial_sect_count); + udata.sect_cnt_size = H5VM_limit_enc_size((uint64_t)sinfo->fspace->serial_sect_count); /* Iterate over all the bins */ for(bin = 0; bin < sinfo->nbins; bin++) { diff --git a/src/H5FSsection.c b/src/H5FSsection.c index c0084b8..b06c9b8 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -35,7 +35,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5FSpkg.h" /* File free space */ #include "H5MFprivate.h" /* File memory management */ -#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ @@ -143,10 +143,10 @@ HDfprintf(stderr, "%s: fspace->addr = %a\n", FUNC, fspace->addr); HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Set non-zero values */ - sinfo->nbins = H5V_log2_gen(fspace->max_sect_size); + sinfo->nbins = H5VM_log2_gen(fspace->max_sect_size); sinfo->sect_prefix_size = (size_t)H5FS_SINFO_PREFIX_SIZE(f); sinfo->sect_off_size = (fspace->max_sect_addr + 7) / 8; - sinfo->sect_len_size = H5V_limit_enc_size((uint64_t)fspace->max_sect_size); + sinfo->sect_len_size = H5VM_limit_enc_size((uint64_t)fspace->max_sect_size); #ifdef H5FS_SINFO_DEBUG HDfprintf(stderr, "%s: fspace->max_sect_size = %Hu\n", FUNC, fspace->max_sect_size); HDfprintf(stderr, "%s: fspace->max_sect_addr = %u\n", FUNC, fspace->max_sect_addr); @@ -499,7 +499,7 @@ HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS_sect_ser HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS_sect_serialize_size", fspace->sinfo->serial_size_count); HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", "H5FS_sect_serialize_size", fspace->serial_sect_count); #endif /* QAK */ - sect_buf_size += fspace->sinfo->serial_size_count * H5V_limit_enc_size((uint64_t)fspace->serial_sect_count); + sect_buf_size += fspace->sinfo->serial_size_count * H5VM_limit_enc_size((uint64_t)fspace->serial_sect_count); /* Size for each differently sized serializable section */ sect_buf_size += fspace->sinfo->serial_size_count * fspace->sinfo->sect_len_size; @@ -765,7 +765,7 @@ H5FS_sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, HDassert(cls); /* Determine correct bin which holds items of at least the section's size */ - bin = H5V_log2_gen(sect->size); + bin = H5VM_log2_gen(sect->size); HDassert(bin < sinfo->nbins); if(sinfo->bins[bin].bin_list == NULL) HGOTO_ERROR(H5E_FSPACE, H5E_NOTFOUND, FAIL, "node's bin is empty?") @@ -966,7 +966,7 @@ HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a\n", FUNC, sect->size, s HDassert(sect->size); /* Determine correct bin which holds items of the section's size */ - bin = H5V_log2_gen(sect->size); + bin = H5VM_log2_gen(sect->size); HDassert(bin < sinfo->nbins); if(sinfo->bins[bin].bin_list == NULL) { if(NULL == (sinfo->bins[bin].bin_list = H5SL_create(H5SL_TYPE_HSIZE, NULL))) @@ -1687,7 +1687,7 @@ H5FS_sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node) HDassert(node); /* Determine correct bin which holds items of at least the section's size */ - bin = H5V_log2_gen(request); + bin = H5VM_log2_gen(request); HDassert(bin < fspace->sinfo->nbins); #ifdef QAK HDfprintf(stderr, "%s: fspace->sinfo->nbins = %u\n", FUNC, fspace->sinfo->nbins); @@ -2121,7 +2121,7 @@ HDfprintf(stderr, "%s: to_ghost = %u\n", FUNC, to_ghost); HDassert(fspace->sinfo->bins); /* Determine correct bin which holds items of at least the section's size */ - bin = H5V_log2_gen(sect->size); + bin = H5VM_log2_gen(sect->size); HDassert(bin < fspace->sinfo->nbins); HDassert(fspace->sinfo->bins[bin].bin_list); diff --git a/src/H5Faccum.c b/src/H5Faccum.c index e0ce292..037c085 100644 --- a/src/H5Faccum.c +++ b/src/H5Faccum.c @@ -40,7 +40,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* File access */ #include "H5FDprivate.h" /* File drivers */ -#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ @@ -151,7 +151,7 @@ H5F_accum_read(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr, size_t new_alloc_size; /* New size of accumulator */ /* Adjust the buffer size to be a power of 2 that is large enough to hold data */ - new_alloc_size = (size_t)1 << (1 + H5V_log2_gen((uint64_t)(new_size - 1))); + new_alloc_size = (size_t)1 << (1 + H5VM_log2_gen((uint64_t)(new_size - 1))); /* Reallocate the metadata accumulator buffer */ if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, new_alloc_size))) @@ -295,7 +295,7 @@ H5F_accum_adjust(H5F_meta_accum_t *accum, H5FD_t *lf, hid_t dxpl_id, size_t new_size; /* New size of accumulator */ /* Adjust the buffer size to be a power of 2 that is large enough to hold data */ - new_size = (size_t)1 << (1 + H5V_log2_gen((uint64_t)((size + accum->size) - 1))); + new_size = (size_t)1 << (1 + H5VM_log2_gen((uint64_t)((size + accum->size) - 1))); /* Check for accumulator getting too big */ if(new_size > H5F_ACCUM_MAX_SIZE) { @@ -606,7 +606,7 @@ H5F_accum_write(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr, size_t new_alloc_size; /* New size of accumulator */ /* Adjust the buffer size to be a power of 2 that is large enough to hold data */ - new_alloc_size = (size_t)1 << (1 + H5V_log2_gen((uint64_t)(size - 1))); + new_alloc_size = (size_t)1 << (1 + H5VM_log2_gen((uint64_t)(size - 1))); /* Reallocate the metadata accumulator buffer */ if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, new_alloc_size))) @@ -649,7 +649,7 @@ HDmemset(f->shared->accum.buf + size, 0, (f->shared->accum.alloc_size - size)); size_t new_size; /* New size of accumulator */ /* Adjust the buffer size to be a power of 2 that is large enough to hold data */ - new_size = (size_t)1 << (1 + H5V_log2_gen((uint64_t)(size - 1))); + new_size = (size_t)1 << (1 + H5VM_log2_gen((uint64_t)(size - 1))); /* Grow the metadata accumulator buffer */ if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, new_size))) @@ -699,7 +699,7 @@ HDmemset(f->shared->accum.buf + clear_size, 0, (f->shared->accum.alloc_size - cl size_t new_size; /* New size of accumulator */ /* Adjust the buffer size to be a power of 2 that is large enough to hold data */ - new_size = (size_t)1 << (1 + H5V_log2_gen((uint64_t)(size - 1))); + new_size = (size_t)1 << (1 + H5VM_log2_gen((uint64_t)(size - 1))); /* Reallocate the metadata accumulator buffer */ if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, new_size))) diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 3565696..2690311 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -27,7 +27,7 @@ #include "H5FDpublic.h" /* File drivers */ /* Private headers needed by this file */ -#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************************/ @@ -119,7 +119,7 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t; /* (Assumes that the high bits of the integer are zero) */ # define UINT64ENCODE_VARLEN(p, n) { \ uint64_t __n = (uint64_t)(n); \ - unsigned _s = H5V_limit_enc_size(__n); \ + unsigned _s = H5VM_limit_enc_size(__n); \ \ *(p)++ = (uint8_t)_s; \ UINT64ENCODE_VAR(p, __n, _s); \ diff --git a/src/H5HFcache.c b/src/H5HFcache.c index ddff0e0..030927d 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -40,7 +40,7 @@ #include "H5HFpkg.h" /* Fractal heaps */ #include "H5MFprivate.h" /* File memory management */ #include "H5MMprivate.h" /* Memory management */ -#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ #include "H5WBprivate.h" /* Wrapped Buffers */ diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index 5d68fd1..7d22ddd 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -39,7 +39,7 @@ #include "H5FLprivate.h" /* Free Lists */ #include "H5HFpkg.h" /* Fractal heaps */ #include "H5MMprivate.h" /* Memory management */ -#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ /* Local Macros */ @@ -638,10 +638,10 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock, unsigned first_row_bits; /* Number of bits used bit addresses in first row */ unsigned num_indirect_rows; /* Number of rows of blocks in each indirect block */ - first_row_bits = H5V_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size) + - H5V_log2_of2(hdr->man_dtable.cparam.width); + first_row_bits = H5VM_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size) + + H5VM_log2_of2(hdr->man_dtable.cparam.width); for(u = hdr->man_dtable.max_direct_rows; u < iblock->nrows; u++) { - num_indirect_rows = (H5V_log2_gen(hdr->man_dtable.row_block_size[u]) - first_row_bits) + 1; + num_indirect_rows = (H5VM_log2_gen(hdr->man_dtable.row_block_size[u]) - first_row_bits) + 1; HDsnprintf(temp_str, sizeof(temp_str), "Row #%u: (# of rows: %u)", (unsigned)u, num_indirect_rows); HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str); diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index afc7f25..dd36613 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -38,7 +38,7 @@ #include "H5Fprivate.h" /* File access */ #include "H5HFpkg.h" /* Fractal heaps */ #include "H5MFprivate.h" /* File memory management */ -#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ /* Local Macros */ @@ -354,7 +354,7 @@ H5HF_man_dblock_new(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t request, if(request < hdr->man_dtable.cparam.start_block_size) min_dblock_size = hdr->man_dtable.cparam.start_block_size; else { - min_dblock_size = ((size_t)1) << (1 + H5V_log2_gen((uint64_t)request)); + min_dblock_size = ((size_t)1) << (1 + H5VM_log2_gen((uint64_t)request)); HDassert(min_dblock_size <= hdr->man_dtable.cparam.max_direct_size); } /* end else */ @@ -549,7 +549,7 @@ H5HF_man_dblock_locate(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t obj_off, unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting parent indirect block */ /* Compute # of rows in child indirect block */ - nrows = (H5V_log2_gen(hdr->man_dtable.row_block_size[row]) - hdr->man_dtable.first_row_bits) + 1; + nrows = (H5VM_log2_gen(hdr->man_dtable.row_block_size[row]) - hdr->man_dtable.first_row_bits) + 1; HDassert(nrows < iblock->nrows); /* child must be smaller than parent */ /* Compute indirect block's entry */ diff --git a/src/H5HFdtable.c b/src/H5HFdtable.c index a7d95bc..607862a 100644 --- a/src/H5HFdtable.c +++ b/src/H5HFdtable.c @@ -37,7 +37,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5HFpkg.h" /* Fractal heaps */ #include "H5MMprivate.h" /* Memory management */ -#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ /* Local Macros */ @@ -104,10 +104,10 @@ H5HF_dtable_init(H5HF_dtable_t *dtable) HDassert(dtable); /* Compute/cache some values */ - dtable->start_bits = H5V_log2_of2((uint32_t)dtable->cparam.start_block_size); - dtable->first_row_bits = dtable->start_bits + H5V_log2_of2(dtable->cparam.width); + dtable->start_bits = H5VM_log2_of2((uint32_t)dtable->cparam.start_block_size); + dtable->first_row_bits = dtable->start_bits + H5VM_log2_of2(dtable->cparam.width); dtable->max_root_rows = (dtable->cparam.max_index - dtable->first_row_bits) + 1; - dtable->max_direct_bits = H5V_log2_of2((uint32_t)dtable->cparam.max_direct_size); + dtable->max_direct_bits = H5VM_log2_of2((uint32_t)dtable->cparam.max_direct_size); dtable->max_direct_rows = (dtable->max_direct_bits - dtable->start_bits) + 2; dtable->num_id_first_row = dtable->cparam.start_block_size * dtable->cparam.width; dtable->max_dir_blk_off_size = H5HF_SIZEOF_OFFSET_LEN(dtable->cparam.max_direct_size); @@ -171,7 +171,7 @@ HDfprintf(stderr, "%s: off = %Hu\n", "H5HF_dtable_lookup", off); H5_ASSIGN_OVERFLOW(/* To: */ *col, /* From: */ (off / dtable->cparam.start_block_size), /* From: */ hsize_t, /* To: */ unsigned); } /* end if */ else { - unsigned high_bit = H5V_log2_gen(off); /* Determine the high bit in the offset */ + unsigned high_bit = H5VM_log2_gen(off); /* Determine the high bit in the offset */ hsize_t off_mask = ((hsize_t)1) << high_bit; /* Compute mask for determining column */ #ifdef QAK @@ -252,7 +252,7 @@ H5HF_dtable_size_to_row(const H5HF_dtable_t *dtable, size_t block_size) if(block_size == dtable->cparam.start_block_size) row = 0; else - row = (H5V_log2_of2((uint32_t)block_size) - H5V_log2_of2((uint32_t)dtable->cparam.start_block_size)) + 1; + row = (H5VM_log2_of2((uint32_t)block_size) - H5VM_log2_of2((uint32_t)dtable->cparam.start_block_size)) + 1; FUNC_LEAVE_NOAPI(row) } /* end H5HF_dtable_size_to_row() */ @@ -283,7 +283,7 @@ H5HF_dtable_size_to_rows(const H5HF_dtable_t *dtable, hsize_t size) */ HDassert(dtable); - rows = (H5V_log2_gen(size) - dtable->first_row_bits) + 1; + rows = (H5VM_log2_gen(size) - dtable->first_row_bits) + 1; FUNC_LEAVE_NOAPI(rows) } /* end H5HF_dtable_size_to_rows() */ diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index e4b89ba..d3c4473 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -37,7 +37,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5HFpkg.h" /* Fractal heaps */ #include "H5MFprivate.h" /* File memory management */ -#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ /* Local Macros */ @@ -46,7 +46,7 @@ #ifndef NDEBUG /* Limit on the size of the max. direct block size */ /* (This is limited to 32-bits currently, because I think it's unlikely to - * need to be larger, the 32-bit limit for H5V_log2_of2(n), and + * need to be larger, the 32-bit limit for H5VM_log2_of2(n), and * some offsets/sizes are encoded with a maxiumum of 32-bits - QAK) */ #define H5HF_MAX_DIRECT_SIZE_LIMIT ((hsize_t)2 * 1024 * 1024 * 1024) @@ -224,7 +224,7 @@ H5HF_hdr_finish_init_phase1(H5HF_hdr_t *hdr) /* Set the size of heap IDs */ hdr->heap_len_size = MIN(hdr->man_dtable.max_dir_blk_off_size, - H5V_limit_enc_size((uint64_t)hdr->max_man_size)); + H5VM_limit_enc_size((uint64_t)hdr->max_man_size)); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1089,7 +1089,7 @@ H5HF_hdr_update_iter(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_size) unsigned child_entry; /* Entry of child indirect block */ /* Compute # of rows needed in child indirect block */ - child_rows_needed = (H5V_log2_of2((uint32_t)min_dblock_size) - H5V_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size)) + 2; + child_rows_needed = (H5VM_log2_of2((uint32_t)min_dblock_size) - H5VM_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size)) + 2; HDassert(child_rows_needed > child_nrows); child_entry = (next_row + (child_rows_needed - child_nrows)) * hdr->man_dtable.cparam.width; if(child_entry > (iblock->nrows * hdr->man_dtable.cparam.width)) diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c index 342e228..c989bfc 100644 --- a/src/H5HFiblock.c +++ b/src/H5HFiblock.c @@ -38,7 +38,7 @@ #include "H5Fprivate.h" /* File access */ #include "H5HFpkg.h" /* Fractal heaps */ #include "H5MFprivate.h" /* File memory management */ -#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ /* Local Macros */ @@ -409,7 +409,7 @@ H5HF_man_iblock_root_create(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_si nrows = hdr->man_dtable.cparam.start_root_rows; - block_row_off = H5V_log2_of2((uint32_t)min_dblock_size) - H5V_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size); + block_row_off = H5VM_log2_of2((uint32_t)min_dblock_size) - H5VM_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size); if(block_row_off > 0) block_row_off++; /* Account for the pair of initial rows of the initial block size */ rows_needed = 1 + block_row_off; @@ -730,7 +730,7 @@ H5HF_man_iblock_root_halve(H5HF_indirect_t *iblock, hid_t dxpl_id) max_child_row = iblock->max_child / hdr->man_dtable.cparam.width; /* Compute new # of rows in root indirect block */ - new_nrows = 1 << (1 + H5V_log2_gen((uint64_t)max_child_row)); + new_nrows = 1 << (1 + H5VM_log2_gen((uint64_t)max_child_row)); /* Check if the indirect block is NOT currently allocated in temp. file space */ /* (temp. file space does not need to be freed) */ @@ -1662,10 +1662,10 @@ H5HF_man_iblock_size(H5F_t *f, hid_t dxpl_id, H5HF_hdr_t *hdr, haddr_t iblock_ad size_t u; /* Local index variable */ entry = hdr->man_dtable.max_direct_rows * hdr->man_dtable.cparam.width; - first_row_bits = H5V_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size) + - H5V_log2_of2(hdr->man_dtable.cparam.width); + first_row_bits = H5VM_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size) + + H5VM_log2_of2(hdr->man_dtable.cparam.width); num_indirect_rows = - (H5V_log2_gen(hdr->man_dtable.row_block_size[hdr->man_dtable.max_direct_rows]) - first_row_bits) + 1; + (H5VM_log2_gen(hdr->man_dtable.row_block_size[hdr->man_dtable.max_direct_rows]) - first_row_bits) + 1; for(u = hdr->man_dtable.max_direct_rows; u < iblock->nrows; u++, num_indirect_rows++) { size_t v; /* Local index variable */ diff --git a/src/H5HFiter.c b/src/H5HFiter.c index 0f2f7a4..137d0ee 100644 --- a/src/H5HFiter.c +++ b/src/H5HFiter.c @@ -36,7 +36,7 @@ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5HFpkg.h" /* Fractal heaps */ -#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ /* Local Macros */ @@ -213,7 +213,7 @@ H5HF_man_iter_start_offset(H5HF_hdr_t *hdr, hid_t dxpl_id, /* Compute # of rows in context indirect block */ child_size = hdr->man_dtable.row_block_size[biter->curr->up->row]; - iblock_nrows = (H5V_log2_gen(child_size) - hdr->man_dtable.first_row_bits) + 1; + iblock_nrows = (H5VM_log2_gen(child_size) - hdr->man_dtable.first_row_bits) + 1; } /* end else */ /* Load indirect block for this context location */ diff --git a/src/H5HFman.c b/src/H5HFman.c index 23afb5e..882d2ba 100644 --- a/src/H5HFman.c +++ b/src/H5HFman.c @@ -38,7 +38,7 @@ #include "H5HFpkg.h" /* Fractal heaps */ #include "H5MFprivate.h" /* File memory management */ #include "H5MMprivate.h" /* Memory management */ -#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ /* Local Macros */ diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h index 23b7c35..a17088b 100644 --- a/src/H5HFpkg.h +++ b/src/H5HFpkg.h @@ -136,7 +136,7 @@ /* Compute the # of bytes required to store an offset into a given buffer size */ #define H5HF_SIZEOF_OFFSET_BITS(b) (((b) + 7) / 8) -#define H5HF_SIZEOF_OFFSET_LEN(l) H5HF_SIZEOF_OFFSET_BITS(H5V_log2_of2((unsigned)(l))) +#define H5HF_SIZEOF_OFFSET_LEN(l) H5HF_SIZEOF_OFFSET_BITS(H5VM_log2_of2((unsigned)(l))) /* Heap ID bit flags */ /* Heap ID version (2 bits: 6-7) */ diff --git a/src/H5HFsection.c b/src/H5HFsection.c index 794d36c..d78114e 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -34,7 +34,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5HFpkg.h" /* Fractal heaps */ #include "H5MMprivate.h" /* Memory management */ -#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ /* Local Macros */ diff --git a/src/H5MF.c b/src/H5MF.c index 4b0668f..956ec18 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -39,7 +39,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* File access */ #include "H5MFpkg.h" /* File memory management */ -#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ @@ -301,7 +301,7 @@ H5MF_alloc_create(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type) fs_create.client = H5FS_CLIENT_FILE_ID; fs_create.shrink_percent = H5MF_FSPACE_SHRINK; fs_create.expand_percent = H5MF_FSPACE_EXPAND; - fs_create.max_sect_addr = 1 + H5V_log2_gen((uint64_t)f->shared->maxaddr); + fs_create.max_sect_addr = 1 + H5VM_log2_gen((uint64_t)f->shared->maxaddr); fs_create.max_sect_size = f->shared->maxaddr; if(NULL == (f->shared->fs_man[type] = H5FS_create(f, dxpl_id, NULL, diff --git a/src/H5Odtype.c b/src/H5Odtype.c index b482115..cb6bf98 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -25,7 +25,7 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Opkg.h" /* Object headers */ #include "H5Tpkg.h" /* Datatypes */ -#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /* PRIVATE PROTOTYPES */ @@ -266,7 +266,7 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **p unsigned j; /* Compute the # of bytes required to store a member offset */ - offset_nbytes = H5V_limit_enc_size((uint64_t)dt->shared->size); + offset_nbytes = H5VM_limit_enc_size((uint64_t)dt->shared->size); /* * Compound datatypes... @@ -891,7 +891,7 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) unsigned offset_nbytes; /* Size needed to encode member offsets */ /* Compute the # of bytes required to store a member offset */ - offset_nbytes = H5V_limit_enc_size((uint64_t)dt->shared->size); + offset_nbytes = H5VM_limit_enc_size((uint64_t)dt->shared->size); /* * Compound datatypes... @@ -1262,7 +1262,7 @@ H5O_dtype_size(const H5F_t *f, const void *_mesg) unsigned offset_nbytes; /* Size needed to encode member offsets */ /* Compute the # of bytes required to store a member offset */ - offset_nbytes = H5V_limit_enc_size((uint64_t)dt->shared->size); + offset_nbytes = H5VM_limit_enc_size((uint64_t)dt->shared->size); /* Compute the total size needed to encode compound datatype */ for(u = 0; u < dt->shared->u.compnd.nmembs; u++) { diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 66c1757..e029da3 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -668,7 +668,7 @@ H5P__fill_value_enc(const void *value, void **_pp, size_t *size) /* Encode the size of a size_t */ enc_value = (uint64_t)dt_size; - enc_size = H5V_limit_enc_size(enc_value); + enc_size = H5VM_limit_enc_size(enc_value); HDassert(enc_size < 256); /* Encode the size */ @@ -697,7 +697,7 @@ H5P__fill_value_enc(const void *value, void **_pp, size_t *size) if(H5T_encode(fill->type, NULL, &dt_size) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype") enc_value = (uint64_t)dt_size; - enc_size = H5V_limit_enc_size(enc_value); + enc_size = H5VM_limit_enc_size(enc_value); } *size += (1 + enc_size); *size += dt_size; @@ -873,7 +873,7 @@ H5P__dcrt_ext_file_list_enc(const void *value, void **_pp, size_t *size) if(NULL != *pp) { /* Encode number of slots used */ enc_value = (uint64_t)efl->nused; - enc_size = H5V_limit_enc_size(enc_value); + enc_size = H5VM_limit_enc_size(enc_value); HDassert(enc_size < 256); *(*pp)++ = (uint8_t)enc_size; UINT64ENCODE_VAR(*pp, enc_value, enc_size); @@ -883,7 +883,7 @@ H5P__dcrt_ext_file_list_enc(const void *value, void **_pp, size_t *size) /* Calculate length of slot name and encode it */ len = HDstrlen(efl->slot[u].name) + 1; enc_value = (uint64_t)len; - enc_size = H5V_limit_enc_size(enc_value); + enc_size = H5VM_limit_enc_size(enc_value); HDassert(enc_size < 256); *(*pp)++ = (uint8_t)enc_size; UINT64ENCODE_VAR(*pp, enc_value, enc_size); @@ -894,14 +894,14 @@ H5P__dcrt_ext_file_list_enc(const void *value, void **_pp, size_t *size) /* Encode offset */ enc_value = (uint64_t)efl->slot[u].offset; - enc_size = H5V_limit_enc_size(enc_value); + enc_size = H5VM_limit_enc_size(enc_value); HDassert(enc_size < 256); *(*pp)++ = (uint8_t)enc_size; UINT64ENCODE_VAR(*pp, enc_value, enc_size); /* encode size */ enc_value = (uint64_t)efl->slot[u].size; - enc_size = H5V_limit_enc_size(enc_value); + enc_size = H5VM_limit_enc_size(enc_value); HDassert(enc_size < 256); *(*pp)++ = (uint8_t)enc_size; UINT64ENCODE_VAR(*pp, enc_value, enc_size); @@ -909,13 +909,13 @@ H5P__dcrt_ext_file_list_enc(const void *value, void **_pp, size_t *size) } /* end if */ /* Calculate size needed for encoding */ - *size += (1 + H5V_limit_enc_size((uint64_t)efl->nused)); + *size += (1 + H5VM_limit_enc_size((uint64_t)efl->nused)); for(u = 0; u < efl->nused; u++) { len = HDstrlen(efl->slot[u].name) + 1; - *size += (1 + H5V_limit_enc_size((uint64_t)len)); + *size += (1 + H5VM_limit_enc_size((uint64_t)len)); *size += len; - *size += (1 + H5V_limit_enc_size((uint64_t)efl->slot[u].offset)); - *size += (1 + H5V_limit_enc_size((uint64_t)efl->slot[u].size)); + *size += (1 + H5VM_limit_enc_size((uint64_t)efl->slot[u].offset)); + *size += (1 + H5VM_limit_enc_size((uint64_t)efl->slot[u].size)); } /* end for */ FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index 552ea63..b5d688b 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -681,7 +681,7 @@ H5P__dxfr_xform_enc(const void *value, void **_pp, size_t *size) /* encode the length of the prefix */ enc_value = (uint64_t)len; - enc_size = H5V_limit_enc_size(enc_value); + enc_size = H5VM_limit_enc_size(enc_value); HDassert(enc_size < 256); *(*pp)++ = (uint8_t)enc_size; UINT64ENCODE_VAR(*pp, enc_value, enc_size); @@ -698,7 +698,7 @@ H5P__dxfr_xform_enc(const void *value, void **_pp, size_t *size) } /* end if */ /* Size of encoded data transform */ - *size += (1 + H5V_limit_enc_size((uint64_t)len)); + *size += (1 + H5VM_limit_enc_size((uint64_t)len)); if(NULL != pexp) *size += len; diff --git a/src/H5Pencdec.c b/src/H5Pencdec.c index ff148b0..0c70c6c 100644 --- a/src/H5Pencdec.c +++ b/src/H5Pencdec.c @@ -118,7 +118,7 @@ H5P__encode_size_t(const void *value, void **_pp, size_t *size) { uint64_t enc_value = (uint64_t)*(const size_t *)value; /* Property value to encode */ uint8_t **pp = (uint8_t **)_pp; - unsigned enc_size = H5V_limit_enc_size(enc_value); /* Size of encoded property */ + unsigned enc_size = H5VM_limit_enc_size(enc_value); /* Size of encoded property */ FUNC_ENTER_PACKAGE_NOERR @@ -159,7 +159,7 @@ herr_t H5P__encode_hsize_t(const void *value, void **_pp, size_t *size) { uint64_t enc_value = (uint64_t)*(const hsize_t *)value; /* Property value to encode */ - unsigned enc_size = H5V_limit_enc_size(enc_value); /* Size of encoded property */ + unsigned enc_size = H5VM_limit_enc_size(enc_value); /* Size of encoded property */ uint8_t **pp = (uint8_t **)_pp; FUNC_ENTER_PACKAGE_NOERR diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 6955a60..a4c09e5 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -2606,7 +2606,7 @@ H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size) H5_ENCODE_UNSIGNED(*pp, config->set_initial_size); enc_value = (uint64_t)config->initial_size; - enc_size = H5V_limit_enc_size(enc_value); + enc_size = H5VM_limit_enc_size(enc_value); HDassert(enc_size < 256); *(*pp)++ = (uint8_t)enc_size; UINT64ENCODE_VAR(*pp, enc_value, enc_size); @@ -2614,13 +2614,13 @@ H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size) H5_ENCODE_DOUBLE(*pp, config->min_clean_fraction); enc_value = (uint64_t)config->max_size; - enc_size = H5V_limit_enc_size(enc_value); + enc_size = H5VM_limit_enc_size(enc_value); HDassert(enc_size < 256); *(*pp)++ = (uint8_t)enc_size; UINT64ENCODE_VAR(*pp, enc_value, enc_size); enc_value = (uint64_t)config->min_size; - enc_size = H5V_limit_enc_size(enc_value); + enc_size = H5VM_limit_enc_size(enc_value); HDassert(enc_size < 256); *(*pp)++ = (uint8_t)enc_size; UINT64ENCODE_VAR(*pp, enc_value, enc_size); @@ -2638,7 +2638,7 @@ H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size) H5_ENCODE_UNSIGNED(*pp, config->apply_max_increment); enc_value = (uint64_t)config->max_increment; - enc_size = H5V_limit_enc_size(enc_value); + enc_size = H5VM_limit_enc_size(enc_value); HDassert(enc_size < 256); *(*pp)++ = (uint8_t)enc_size; UINT64ENCODE_VAR(*pp, enc_value, enc_size); @@ -2660,7 +2660,7 @@ H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size) H5_ENCODE_UNSIGNED(*pp, config->apply_max_decrement); enc_value = (uint64_t)config->max_decrement; - enc_size = H5V_limit_enc_size(enc_value); + enc_size = H5VM_limit_enc_size(enc_value); HDassert(enc_size < 256); *(*pp)++ = (uint8_t)enc_size; UINT64ENCODE_VAR(*pp, enc_value, enc_size); @@ -2681,15 +2681,15 @@ H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size) /* Compute encoded size of variably-encoded values */ enc_value = (uint64_t)config->initial_size; - *size += 1 + H5V_limit_enc_size(enc_value); + *size += 1 + H5VM_limit_enc_size(enc_value); enc_value = (uint64_t)config->max_size; - *size += 1 + H5V_limit_enc_size(enc_value); + *size += 1 + H5VM_limit_enc_size(enc_value); enc_value = (uint64_t)config->min_size; - *size += 1 + H5V_limit_enc_size(enc_value); + *size += 1 + H5VM_limit_enc_size(enc_value); enc_value = (uint64_t)config->max_increment; - *size += 1 + H5V_limit_enc_size(enc_value); + *size += 1 + H5VM_limit_enc_size(enc_value); enc_value = (uint64_t)config->max_decrement; - *size += 1 + H5V_limit_enc_size(enc_value); + *size += 1 + H5VM_limit_enc_size(enc_value); /* Compute encoded size of fixed-size values */ *size += (5 + (sizeof(unsigned) * 8) + (sizeof(double) * 8) + diff --git a/src/H5Plapl.c b/src/H5Plapl.c index aa02546..676b574 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -514,7 +514,7 @@ H5P_lacc_elink_pref_enc(const void *value, void **_pp, size_t *size) len = HDstrlen(elink_pref); enc_value = (uint64_t)len; - enc_size = H5V_limit_enc_size(enc_value); + enc_size = H5VM_limit_enc_size(enc_value); HDassert(enc_size < 256); if(NULL != *pp) { diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c index 32f6a1b..df4ebb6 100644 --- a/src/H5Pocpl.c +++ b/src/H5Pocpl.c @@ -1495,7 +1495,7 @@ H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size) /* encode nused value */ enc_value = (uint64_t)pline->nused; - enc_size = H5V_limit_enc_size(enc_value); + enc_size = H5VM_limit_enc_size(enc_value); HDassert(enc_size < 256); *(*pp)++ = (uint8_t)enc_size; UINT64ENCODE_VAR(*pp, enc_value, enc_size); @@ -1525,7 +1525,7 @@ H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size) /* encode cd_nelmts */ enc_value = (uint64_t)pline->filter[u].cd_nelmts; - enc_size = H5V_limit_enc_size(enc_value); + enc_size = H5VM_limit_enc_size(enc_value); HDassert(enc_size < 256); *(*pp)++ = (uint8_t)enc_size; UINT64ENCODE_VAR(*pp, enc_value, enc_size); @@ -1538,12 +1538,12 @@ H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size) /* calculate size required for encoding */ *size += 1; - *size += (1 + H5V_limit_enc_size((uint64_t)pline->nused)); + *size += (1 + H5VM_limit_enc_size((uint64_t)pline->nused)); for(u = 0; u < pline->nused; u++) { *size += (sizeof(int32_t) + sizeof(unsigned) + 1); if(NULL != pline->filter[u].name) *size += H5Z_COMMON_NAME_LEN; - *size += (1 + H5V_limit_enc_size((uint64_t)pline->filter[u].cd_nelmts)); + *size += (1 + H5VM_limit_enc_size((uint64_t)pline->filter[u].cd_nelmts)); *size += pline->filter[u].cd_nelmts * sizeof(unsigned); } /* end for */ diff --git a/src/H5Sall.c b/src/H5Sall.c index 19d1efc..24caad2 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -27,7 +27,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* ID Functions */ #include "H5Spkg.h" /* Dataspace functions */ -#include "H5Vprivate.h" /* Vector functions */ +#include "H5VMprivate.h" /* Vector functions */ /* Static function prototypes */ @@ -162,7 +162,7 @@ H5S_all_iter_coords (const H5S_sel_iter_t *iter, hsize_t *coords) HDassert (coords); /* Calculate the coordinates for the current iterator offset */ - if(H5V_array_calc(iter->u.all.elmt_offset,iter->rank,iter->dims,coords)<0) + if(H5VM_array_calc(iter->u.all.elmt_offset,iter->rank,iter->dims,coords)<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't retrieve coordinates"); done: diff --git a/src/H5Shyper.c b/src/H5Shyper.c index f8d87e4..c97c9b6 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -28,7 +28,7 @@ #include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* ID Functions */ #include "H5Spkg.h" /* Dataspace functions */ -#include "H5Vprivate.h" /* Vector functions */ +#include "H5VMprivate.h" /* Vector functions */ /* Local datatypes */ @@ -464,7 +464,7 @@ H5S_hyper_iter_coords (const H5S_sel_iter_t *iter, hsize_t *coords) HDassert(v >= 0); /* Compute the coords for the flattened dimensions */ - H5V_array_calc(iter->u.hyp.off[v], (unsigned)((begin - u) + 1), &(iter->dims[u]), &(coords[u])); + H5VM_array_calc(iter->u.hyp.off[v], (unsigned)((begin - u) + 1), &(iter->dims[u]), &(coords[u])); /* Continue to faster dimension in both indices */ u--; @@ -4102,7 +4102,7 @@ H5S_hyper_project_scalar(const H5S_t *space, hsize_t *offset) } /* end else */ /* Calculate offset of selection in projected buffer */ - *offset = H5V_array_offset(space->extent.rank, space->extent.size, block); + *offset = H5VM_array_offset(space->extent.rank, space->extent.size, block); done: FUNC_LEAVE_NOAPI(ret_value) @@ -4294,7 +4294,7 @@ H5S_hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *off HDmemset(block, 0, sizeof(block)); for(u = 0; u < (base_space->extent.rank - new_space->extent.rank); u++) block[u] = opt_diminfo[u].start; - *offset = H5V_array_offset(base_space->extent.rank, base_space->extent.size, block); + *offset = H5VM_array_offset(base_space->extent.rank, base_space->extent.size, block); /* Set the correct dimensions for the base & new spaces */ base_space_dim = base_space->extent.rank - new_space->extent.rank; @@ -4377,7 +4377,7 @@ H5S_hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *off } /* end while */ /* Compute the offset for the down-projection */ - *offset = H5V_array_offset(base_space->extent.rank, base_space->extent.size, block); + *offset = H5VM_array_offset(base_space->extent.rank, base_space->extent.size, block); /* Project the base space's selection down in less dimensions */ if(H5S_hyper_project_simple_lower(base_space, new_space) < 0) diff --git a/src/H5Smpio.c b/src/H5Smpio.c index 868a00f..77e902f 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -35,7 +35,7 @@ #include "H5Oprivate.h" /* Object headers */ #include "H5Pprivate.h" /* Property lists */ #include "H5Spkg.h" /* Dataspaces */ -#include "H5Vprivate.h" /* Vector and array functions */ +#include "H5VMprivate.h" /* Vector and array functions */ #ifdef H5_HAVE_PARALLEL @@ -453,7 +453,7 @@ H5S_mpio_span_hyper_type(const H5S_t *space, size_t elmt_size, elmt_type_is_derived = TRUE; /* Compute 'down' sizes for each dimension */ - if(H5V_array_down(space->extent.rank, space->extent.size, down) < 0) + if(H5VM_array_down(space->extent.rank, space->extent.size, down) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGETSIZE, FAIL, "couldn't compute 'down' dimension sizes") /* Obtain derived data type */ diff --git a/src/H5Snone.c b/src/H5Snone.c index 021dd61..3c5eccc 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -27,7 +27,7 @@ #include "H5Eprivate.h" #include "H5Iprivate.h" #include "H5Spkg.h" -#include "H5Vprivate.h" +#include "H5VMprivate.h" #include "H5Dprivate.h" /* Static function prototypes */ diff --git a/src/H5Spoint.c b/src/H5Spoint.c index b758a92..70842df 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -29,7 +29,7 @@ #include "H5Iprivate.h" /* ID Functions */ #include "H5MMprivate.h" /* Memory Management functions */ #include "H5Spkg.h" /* Dataspace functions */ -#include "H5Vprivate.h" /* Vector functions */ +#include "H5VMprivate.h" /* Vector functions */ /* Static function prototypes */ @@ -1383,7 +1383,7 @@ H5S_point_project_scalar(const H5S_t *space, hsize_t *offset) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "point selection of one element has more than one node!") /* Calculate offset of selection in projected buffer */ - *offset = H5V_array_offset(space->extent.rank, space->extent.size, node->pnt); + *offset = H5VM_array_offset(space->extent.rank, space->extent.size, node->pnt); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1437,7 +1437,7 @@ H5S_point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *off /* Calculate offset of selection in projected buffer */ HDmemset(block, 0, sizeof(block)); HDmemcpy(block, base_space->select.sel_info.pnt_lst->head->pnt, sizeof(hsize_t) * rank_diff); - *offset = H5V_array_offset(base_space->extent.rank, base_space->extent.size, block); + *offset = H5VM_array_offset(base_space->extent.rank, base_space->extent.size, block); /* Iterate through base space's point nodes, copying the point information */ base_node = base_space->select.sel_info.pnt_lst->head; diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 1eb0cbc..44688b6 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -29,7 +29,7 @@ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Spkg.h" /* Dataspaces */ -#include "H5Vprivate.h" /* Vector and array functions */ +#include "H5VMprivate.h" /* Vector and array functions */ #include "H5WBprivate.h" /* Wrapped Buffers */ /* Local functions */ @@ -1872,8 +1872,8 @@ H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr, * and set the remaining dimensions to 1 */ rank_diff = new_space_rank - base_space_rank; - H5V_array_fill(new_space_dims, &tmp_dim_size, sizeof(tmp_dim_size), rank_diff); - H5V_array_fill(new_space_maxdims, &tmp_dim_size, sizeof(tmp_dim_size), rank_diff); + H5VM_array_fill(new_space_dims, &tmp_dim_size, sizeof(tmp_dim_size), rank_diff); + H5VM_array_fill(new_space_maxdims, &tmp_dim_size, sizeof(tmp_dim_size), rank_diff); HDmemcpy(&new_space_dims[rank_diff], base_space_dims, sizeof(new_space_dims[0]) * base_space_rank); HDmemcpy(&new_space_maxdims[rank_diff], base_space_maxdims, sizeof(new_space_maxdims[0]) * base_space_rank); } /* end if */ @@ -2038,7 +2038,7 @@ H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *_b /* Fill each sequence in memory with fill value */ HDassert((len[curr_seq] % fill_size) == 0); - H5V_array_fill(buf, fill, fill_size, (len[curr_seq] / fill_size)); + H5VM_array_fill(buf, fill, fill_size, (len[curr_seq] / fill_size)); } /* end for */ /* Decrement number of elements left to process */ diff --git a/src/H5V.c b/src/H5V.c deleted file mode 100644 index 3277b90..0000000 --- a/src/H5V.c +++ /dev/null @@ -1,1712 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * Programmer: Robb Matzke - * Friday, October 10, 1997 - */ - - -#include "H5private.h" -#include "H5Eprivate.h" -#include "H5Oprivate.h" -#include "H5Vprivate.h" - -/* Local typedefs */ -typedef struct H5V_memcpy_ud_t { - unsigned char *dst; /* Pointer to destination buffer */ - const unsigned char *src; /* Pointer to source buffer */ -} H5V_memcpy_ud_t; - -/* Local macros */ -#define H5V_HYPER_NDIMS H5O_LAYOUT_NDIMS - -/* Local prototypes */ -static void -H5V_stride_optimize1(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, - const hsize_t *size, hsize_t *stride1); -static void -H5V_stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, - const hsize_t *size, hsize_t *stride1, hsize_t *stride2); -#ifdef LATER -static void -H5V_stride_copy2(hsize_t nelmts, hsize_t elmt_size, - unsigned dst_n, const hsize_t *dst_size, const ssize_t *dst_stride, void *_dst, - unsigned src_n, const hsize_t *src_size, const ssize_t *src_stride, const void *_src); -#endif /* LATER */ - - -/*------------------------------------------------------------------------- - * Function: H5V_stride_optimize1 - * - * Purpose: Given a stride vector which references elements of the - * specified size, optimize the dimensionality, the stride - * vector, and the element size to minimize the dimensionality - * and the number of memory accesses. - * - * All arguments are passed by reference and their values may be - * modified by this function. - * - * Return: None - * - * Programmer: Robb Matzke - * Saturday, October 11, 1997 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -H5V_stride_optimize1(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, - const hsize_t *size, hsize_t *stride1) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - /* - * This has to be true because if we optimize the dimensionality down to - * zero we still must make one reference. - */ - HDassert(1 == H5V_vector_reduce_product(0, NULL)); - - /* - * Combine adjacent memory accesses - */ - while (*np && stride1[*np-1]>0 && - (hsize_t)(stride1[*np-1])==*elmt_size) { - *elmt_size *= size[*np-1]; - if (--*np) - stride1[*np-1] += size[*np] * stride1[*np]; - } - - FUNC_LEAVE_NOAPI_VOID -} - - -/*------------------------------------------------------------------------- - * Function: H5V_stride_optimize2 - * - * Purpose: Given two stride vectors which reference elements of the - * specified size, optimize the dimensionality, the stride - * vectors, and the element size to minimize the dimensionality - * and the number of memory accesses. - * - * All arguments are passed by reference and their values may be - * modified by this function. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Saturday, October 11, 1997 - * - * Modifications: - * Unrolled loops for common cases - * Quincey Koziol - * ?, ? ?, 2001? - * - *------------------------------------------------------------------------- - */ -static void -H5V_stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, - const hsize_t *size, hsize_t *stride1, hsize_t *stride2) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - /* - * This has to be true because if we optimize the dimensionality down to - * zero we still must make one reference. - */ - HDassert(1 == H5V_vector_reduce_product(0, NULL)); - HDassert(*elmt_size>0); - - /* - * Combine adjacent memory accesses - */ - - /* Unroll loop for common cases */ - switch(*np) { - case 1: /* For 0-D datasets (dunno if this ever gets used...) */ - if(stride1[0] == *elmt_size && stride2[0] == *elmt_size) { - *elmt_size *= size[0]; - --*np; /* *np decrements to a value of 0 now */ - } /* end if */ - break; - - case 2: /* For 1-D datasets */ - if(stride1[1] == *elmt_size && stride2[1] == *elmt_size) { - *elmt_size *= size[1]; - --*np; /* *np decrements to a value of 1 now */ - stride1[0] += size[1] * stride1[1]; - stride2[0] += size[1] * stride2[1]; - - if(stride1[0] == *elmt_size && stride2[0] == *elmt_size) { - *elmt_size *= size[0]; - --*np; /* *np decrements to a value of 0 now */ - } /* end if */ - } /* end if */ - break; - - case 3: /* For 2-D datasets */ - if(stride1[2] == *elmt_size && stride2[2] == *elmt_size) { - *elmt_size *= size[2]; - --*np; /* *np decrements to a value of 2 now */ - stride1[1] += size[2] * stride1[2]; - stride2[1] += size[2] * stride2[2]; - - if(stride1[1] == *elmt_size && stride2[1] == *elmt_size) { - *elmt_size *= size[1]; - --*np; /* *np decrements to a value of 1 now */ - stride1[0] += size[1] * stride1[1]; - stride2[0] += size[1] * stride2[1]; - - if(stride1[0] == *elmt_size && stride2[0] == *elmt_size) { - *elmt_size *= size[0]; - --*np; /* *np decrements to a value of 0 now */ - } /* end if */ - } /* end if */ - } /* end if */ - break; - - case 4: /* For 3-D datasets */ - if(stride1[3] == *elmt_size && stride2[3] == *elmt_size) { - *elmt_size *= size[3]; - --*np; /* *np decrements to a value of 3 now */ - stride1[2] += size[3] * stride1[3]; - stride2[2] += size[3] * stride2[3]; - - if(stride1[2] == *elmt_size && stride2[2] == *elmt_size) { - *elmt_size *= size[2]; - --*np; /* *np decrements to a value of 2 now */ - stride1[1] += size[2] * stride1[2]; - stride2[1] += size[2] * stride2[2]; - - if(stride1[1] == *elmt_size && stride2[1] == *elmt_size) { - *elmt_size *= size[1]; - --*np; /* *np decrements to a value of 1 now */ - stride1[0] += size[1] * stride1[1]; - stride2[0] += size[1] * stride2[1]; - - if(stride1[0] == *elmt_size && stride2[0] == *elmt_size) { - *elmt_size *= size[0]; - --*np; /* *np decrements to a value of 0 now */ - } /* end if */ - } /* end if */ - } /* end if */ - } /* end if */ - break; - - default: - while (*np && - stride1[*np-1] == *elmt_size && - stride2[*np-1] == *elmt_size) { - *elmt_size *= size[*np-1]; - if (--*np) { - stride1[*np-1] += size[*np] * stride1[*np]; - stride2[*np-1] += size[*np] * stride2[*np]; - } - } - break; - } /* end switch */ - - FUNC_LEAVE_NOAPI_VOID -} - - -/*------------------------------------------------------------------------- - * Function: H5V_hyper_stride - * - * Purpose: Given a description of a hyperslab, this function returns - * (through STRIDE[]) the byte strides appropriate for accessing - * all bytes of the hyperslab and the byte offset where the - * striding will begin. The SIZE can be passed to the various - * stride functions. - * - * The dimensionality of the whole array, the hyperslab, and the - * returned stride array is N. The whole array dimensions are - * TOTAL_SIZE and the hyperslab is at offset OFFSET and has - * dimensions SIZE. - * - * The stride and starting point returned will cause the - * hyperslab elements to be referenced in C order. - * - * Return: Success: Byte offset from beginning of array to start - * of striding. - * - * Failure: abort() -- should never fail - * - * Programmer: Robb Matzke - * Saturday, October 11, 1997 - * - * Modifications: - * Unrolled loops for common cases - * Quincey Koziol - * ?, ? ?, 2001? - * - *------------------------------------------------------------------------- - */ -hsize_t -H5V_hyper_stride(unsigned n, const hsize_t *size, - const hsize_t *total_size, const hsize_t *offset, - hsize_t *stride/*out*/) -{ - hsize_t skip; /*starting point byte offset */ - hsize_t acc; /*accumulator */ - int i; /*counter */ - hsize_t ret_value; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(n <= H5V_HYPER_NDIMS); - HDassert(size); - HDassert(total_size); - HDassert(stride); - - /* init */ - HDassert(n>0); - stride[n-1] = 1; - skip = offset ? offset[n-1] : 0; - - switch(n) { - case 2: /* 1-D dataset */ - HDassert(total_size[1]>=size[1]); - stride[0] = total_size[1]-size[1]; /*overflow checked*/ - acc = total_size[1]; - skip += acc * (offset ? offset[0] : 0); - break; - - case 3: /* 2-D dataset */ - HDassert(total_size[2]>=size[2]); - stride[1] = total_size[2]-size[2]; /*overflow checked*/ - acc = total_size[2]; - skip += acc * (offset ? (hsize_t)offset[1] : 0); - - HDassert(total_size[1]>=size[1]); - stride[0] = acc * (total_size[1] - size[1]); /*overflow checked*/ - acc *= total_size[1]; - skip += acc * (offset ? (hsize_t)offset[0] : 0); - break; - - case 4: /* 3-D dataset */ - HDassert(total_size[3]>=size[3]); - stride[2] = total_size[3]-size[3]; /*overflow checked*/ - acc = total_size[3]; - skip += acc * (offset ? (hsize_t)offset[2] : 0); - - HDassert(total_size[2]>=size[2]); - stride[1] = acc * (total_size[2] - size[2]); /*overflow checked*/ - acc *= total_size[2]; - skip += acc * (offset ? (hsize_t)offset[1] : 0); - - HDassert(total_size[1]>=size[1]); - stride[0] = acc * (total_size[1] - size[1]); /*overflow checked*/ - acc *= total_size[1]; - skip += acc * (offset ? (hsize_t)offset[0] : 0); - break; - - default: - /* others */ - for (i=(int)(n-2), acc=1; i>=0; --i) { - HDassert(total_size[i+1]>=size[i+1]); - stride[i] = acc * (total_size[i+1] - size[i+1]); /*overflow checked*/ - acc *= total_size[i+1]; - skip += acc * (offset ? (hsize_t)offset[i] : 0); - } - break; - } /* end switch */ - - /* Set return value */ - ret_value=skip; - - FUNC_LEAVE_NOAPI(ret_value) -} - - -/*------------------------------------------------------------------------- - * Function: H5V_hyper_eq - * - * Purpose: Determines whether two hyperslabs are equal. This function - * assumes that both hyperslabs are relative to the same array, - * for if not, they could not possibly be equal. - * - * Return: Success: TRUE if the hyperslabs are equal (that is, - * both refer to exactly the same elements of an - * array) - * - * FALSE otherwise. - * - * Failure: TRUE the rank is zero or if both hyperslabs - * are of zero size. - * - * Programmer: Robb Matzke - * Friday, October 17, 1997 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -htri_t -H5V_hyper_eq(unsigned n, - const hsize_t *offset1, const hsize_t *size1, - const hsize_t *offset2, const hsize_t *size2) -{ - hsize_t nelmts1 = 1, nelmts2 = 1; - unsigned i; - htri_t ret_value=TRUE; /* Return value */ - - /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - if (n == 0) HGOTO_DONE(TRUE) - - for (i=0; i 0 && n <= H5V_HYPER_NDIMS); - HDassert(_size); - HDassert(total_size); - HDassert(dst); -#ifndef NDEBUG - for (u = 0; u < n; u++) { - HDassert(_size[u] > 0); - HDassert(total_size[u] > 0); - } -#endif - - /* Copy the size vector so we can modify it */ - H5V_vector_cpy(n, size, _size); - - /* Compute an optimal destination stride vector */ - dst_start = H5V_hyper_stride(n, size, total_size, offset, dst_stride); - H5V_stride_optimize1(&n, &elmt_size, size, dst_stride); - - /* Copy */ - ret_value = H5V_stride_fill(n, elmt_size, size, dst_stride, dst+dst_start, - fill_value); - - FUNC_LEAVE_NOAPI(ret_value) -} - - -/*------------------------------------------------------------------------- - * Function: H5V_hyper_copy - * - * Purpose: Copies a hyperslab from the source to the destination. - * - * A hyperslab is a logically contiguous region of - * multi-dimensional size SIZE of an array whose dimensionality - * is N and whose total size is DST_TOTAL_SIZE or SRC_TOTAL_SIZE. - * The minimum corner of the hyperslab begins at a - * multi-dimensional offset from the minimum corner of the DST - * (destination) or SRC (source) array. The sizes and offsets - * are assumed to be in C order, that is, the first size/offset - * varies the slowest while the last varies the fastest in the - * mapping from N-dimensional space to linear space. This - * function assumes that the array elements are single bytes (if - * your array has multi-byte elements then add an additional - * dimension whose size is that of your element). - * - * The SRC and DST array may be the same array, but the results - * are undefined if the source hyperslab overlaps the - * destination hyperslab. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Friday, October 10, 1997 - * - * Modifications: - * Unrolled loops for common cases - * Quincey Koziol - * ?, ? ?, 2001? - * - *------------------------------------------------------------------------- - */ -herr_t -H5V_hyper_copy(unsigned n, const hsize_t *_size, - - /*destination*/ - const hsize_t *dst_size, const hsize_t *dst_offset, - void *_dst, - - /*source*/ - const hsize_t *src_size, const hsize_t *src_offset, - const void *_src) -{ - const uint8_t *src = (const uint8_t*)_src; /*cast for ptr arithmtc */ - uint8_t *dst = (uint8_t*) _dst; /*cast for ptr arithmtc */ - hsize_t size[H5V_HYPER_NDIMS]; /*a modifiable _size */ - hsize_t src_stride[H5V_HYPER_NDIMS]; /*source stride info */ - hsize_t dst_stride[H5V_HYPER_NDIMS]; /*dest stride info */ - hsize_t dst_start, src_start; /*offset to start at */ - hsize_t elmt_size = 1; /*element size in bytes */ - herr_t ret_value; /*return status */ -#ifndef NDEBUG - unsigned u; -#endif - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - /* check args */ - HDassert(n > 0 && n <= H5V_HYPER_NDIMS); - HDassert(_size); - HDassert(dst_size); - HDassert(src_size); - HDassert(dst); - HDassert(src); -#ifndef NDEBUG - for (u = 0; u < n; u++) { - HDassert(_size[u] > 0); - HDassert(dst_size[u] > 0); - HDassert(src_size[u] > 0); - } -#endif - - /* Copy the size vector so we can modify it */ - H5V_vector_cpy(n, size, _size); - - /* Compute stride vectors for source and destination */ -#ifdef NO_INLINED_CODE - dst_start = H5V_hyper_stride(n, size, dst_size, dst_offset, dst_stride); - src_start = H5V_hyper_stride(n, size, src_size, src_offset, src_stride); -#else /* NO_INLINED_CODE */ - /* in-line version of two calls to H5V_hyper_stride() */ - { - hsize_t dst_acc; /*accumulator */ - hsize_t src_acc; /*accumulator */ - int ii; /*counter */ - - /* init */ - HDassert(n>0); - dst_stride[n-1] = 1; - src_stride[n-1] = 1; - dst_start = dst_offset ? dst_offset[n-1] : 0; - src_start = src_offset ? src_offset[n-1] : 0; - - /* Unroll loop for common cases */ - switch(n) { - case 2: - HDassert(dst_size[1]>=size[1]); - HDassert(src_size[1]>=size[1]); - dst_stride[0] = dst_size[1] - size[1]; /*overflow checked*/ - src_stride[0] = src_size[1] - size[1]; /*overflow checked*/ - dst_acc = dst_size[1]; - src_acc = src_size[1]; - dst_start += dst_acc * (dst_offset ? dst_offset[0] : 0); - src_start += src_acc * (src_offset ? src_offset[0] : 0); - break; - - case 3: - HDassert(dst_size[2]>=size[2]); - HDassert(src_size[2]>=size[2]); - dst_stride[1] = dst_size[2] - size[2]; /*overflow checked*/ - src_stride[1] = src_size[2] - size[2]; /*overflow checked*/ - dst_acc = dst_size[2]; - src_acc = src_size[2]; - dst_start += dst_acc * (dst_offset ? dst_offset[1] : 0); - src_start += src_acc * (src_offset ? src_offset[1] : 0); - - HDassert(dst_size[1]>=size[1]); - HDassert(src_size[1]>=size[1]); - dst_stride[0] = dst_acc * (dst_size[1] - size[1]); /*overflow checked*/ - src_stride[0] = src_acc * (src_size[1] - size[1]); /*overflow checked*/ - dst_acc *= dst_size[1]; - src_acc *= src_size[1]; - dst_start += dst_acc * (dst_offset ? dst_offset[0] : 0); - src_start += src_acc * (src_offset ? src_offset[0] : 0); - break; - - case 4: - HDassert(dst_size[3]>=size[3]); - HDassert(src_size[3]>=size[3]); - dst_stride[2] = dst_size[3] - size[3]; /*overflow checked*/ - src_stride[2] = src_size[3] - size[3]; /*overflow checked*/ - dst_acc = dst_size[3]; - src_acc = src_size[3]; - dst_start += dst_acc * (dst_offset ? dst_offset[2] : 0); - src_start += src_acc * (src_offset ? src_offset[2] : 0); - - HDassert(dst_size[2]>=size[2]); - HDassert(src_size[2]>=size[2]); - dst_stride[1] = dst_acc * (dst_size[2] - size[2]); /*overflow checked*/ - src_stride[1] = src_acc * (src_size[2] - size[2]); /*overflow checked*/ - dst_acc *= dst_size[2]; - src_acc *= src_size[2]; - dst_start += dst_acc * (dst_offset ? dst_offset[1] : 0); - src_start += src_acc * (src_offset ? src_offset[1] : 0); - - HDassert(dst_size[1]>=size[1]); - HDassert(src_size[1]>=size[1]); - dst_stride[0] = dst_acc * (dst_size[1] - size[1]); /*overflow checked*/ - src_stride[0] = src_acc * (src_size[1] - size[1]); /*overflow checked*/ - dst_acc *= dst_size[1]; - src_acc *= src_size[1]; - dst_start += dst_acc * (dst_offset ? dst_offset[0] : 0); - src_start += src_acc * (src_offset ? src_offset[0] : 0); - break; - - default: - /* others */ - for (ii=(int)(n-2), dst_acc=1, src_acc=1; ii>=0; --ii) { - HDassert(dst_size[ii+1]>=size[ii+1]); - HDassert(src_size[ii+1]>=size[ii+1]); - dst_stride[ii] = dst_acc * (dst_size[ii+1] - size[ii+1]); /*overflow checked*/ - src_stride[ii] = src_acc * (src_size[ii+1] - size[ii+1]); /*overflow checked*/ - dst_acc *= dst_size[ii+1]; - src_acc *= src_size[ii+1]; - dst_start += dst_acc * (dst_offset ? dst_offset[ii] : 0); - src_start += src_acc * (src_offset ? src_offset[ii] : 0); - } - break; - } /* end switch */ - } -#endif /* NO_INLINED_CODE */ - - /* Optimize the strides as a pair */ - H5V_stride_optimize2(&n, &elmt_size, size, dst_stride, src_stride); - - /* Perform the copy in terms of stride */ - ret_value = H5V_stride_copy(n, elmt_size, size, - dst_stride, dst+dst_start, src_stride, src+src_start); - - FUNC_LEAVE_NOAPI(ret_value) -} - - -/*------------------------------------------------------------------------- - * Function: H5V_stride_fill - * - * Purpose: Fills all bytes of a hyperslab with the same value using - * memset(). - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Saturday, October 11, 1997 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -herr_t -H5V_stride_fill(unsigned n, hsize_t elmt_size, const hsize_t *size, - const hsize_t *stride, void *_dst, unsigned fill_value) -{ - uint8_t *dst = (uint8_t*)_dst; /*cast for ptr arithmetic */ - hsize_t idx[H5V_HYPER_NDIMS]; /*1-origin indices */ - hsize_t nelmts; /*number of elements to fill */ - hsize_t i; /*counter */ - int j; /*counter */ - hbool_t carry; /*subtraction carray value */ - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(elmt_size < SIZET_MAX); - - H5V_vector_cpy(n, idx, size); - nelmts = H5V_vector_reduce_product(n, size); - for (i=0; i=0 && carry; --j) { - dst += stride[j]; - - if (--idx[j]) - carry = FALSE; - else { - HDassert(size); - idx[j] = size[j]; - } /* end else */ - } - } - - FUNC_LEAVE_NOAPI(SUCCEED) -} - - -/*------------------------------------------------------------------------- - * Function: H5V_stride_copy - * - * Purpose: Uses DST_STRIDE and SRC_STRIDE to advance through the arrays - * DST and SRC while copying bytes from SRC to DST. This - * function minimizes the number of calls to memcpy() by - * combining various strides, but it will never touch memory - * outside the hyperslab defined by the strides. - * - * Note: If the src_stride is all zero and elmt_size is one, then it's - * probably more efficient to use H5V_stride_fill() instead. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Saturday, October 11, 1997 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -herr_t -H5V_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size, - const hsize_t *dst_stride, void *_dst, - const hsize_t *src_stride, const void *_src) -{ - uint8_t *dst = (uint8_t*)_dst; /*cast for ptr arithmetic*/ - const uint8_t *src = (const uint8_t*) _src; /*cast for ptr arithmetic*/ - hsize_t idx[H5V_HYPER_NDIMS]; /*1-origin indices */ - hsize_t nelmts; /*num elements to copy */ - hsize_t i; /*counter */ - int j; /*counters */ - hbool_t carry; /*carray for subtraction*/ - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(elmt_size=0 && carry; --j) { - src += src_stride[j]; - dst += dst_stride[j]; - - if (--idx[j]) - carry = FALSE; - else { - HDassert(size); - idx[j] = size[j]; - } - } - } - } else { - H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t); - HDmemcpy (dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */ - } - - FUNC_LEAVE_NOAPI(SUCCEED) -} - - -/*------------------------------------------------------------------------- - * Function: H5V_stride_copy_s - * - * Purpose: Uses DST_STRIDE and SRC_STRIDE to advance through the arrays - * DST and SRC while copying bytes from SRC to DST. This - * function minimizes the number of calls to memcpy() by - * combining various strides, but it will never touch memory - * outside the hyperslab defined by the strides. - * - * Note: If the src_stride is all zero and elmt_size is one, then it's - * probably more efficient to use H5V_stride_fill() instead. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Saturday, October 11, 1997 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -herr_t -H5V_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size, - const hssize_t *dst_stride, void *_dst, - const hssize_t *src_stride, const void *_src) -{ - uint8_t *dst = (uint8_t*)_dst; /*cast for ptr arithmetic*/ - const uint8_t *src = (const uint8_t*) _src; /*cast for ptr arithmetic*/ - hsize_t idx[H5V_HYPER_NDIMS]; /*1-origin indices */ - hsize_t nelmts; /*num elements to copy */ - hsize_t i; /*counter */ - int j; /*counters */ - hbool_t carry; /*carray for subtraction*/ - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(elmt_size=0 && carry; --j) { - src += src_stride[j]; - dst += dst_stride[j]; - - if (--idx[j]) - carry = FALSE; - else { - HDassert(size); - idx[j] = size[j]; - } - } - } - } else { - H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t); - HDmemcpy (dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */ - } - - FUNC_LEAVE_NOAPI(SUCCEED) -} - -#ifdef LATER - -/*------------------------------------------------------------------------- - * Function: H5V_stride_copy2 - * - * Purpose: Similar to H5V_stride_copy() except the source and - * destination each have their own dimensionality and size and - * we copy exactly NELMTS elements each of size ELMT_SIZE. The - * size counters wrap if NELMTS is more than a size counter. - * - * Return: None - * - * Programmer: Robb Matzke - * Saturday, October 11, 1997 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -H5V_stride_copy2(hsize_t nelmts, hsize_t elmt_size, - - /* destination */ - unsigned dst_n, const hsize_t *dst_size, - const hsize_t *dst_stride, - void *_dst, - - /* source */ - unsigned src_n, const hsize_t *src_size, - const hsize_t *src_stride, - const void *_src) -{ - uint8_t *dst = (uint8_t *) _dst; - const uint8_t *src = (const uint8_t *) _src; - hsize_t dst_idx[H5V_HYPER_NDIMS]; - hsize_t src_idx[H5V_HYPER_NDIMS]; - hsize_t i; /* Local index variable */ - int j; /* Local index variable */ - hbool_t carry; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(elmt_size < SIZET_MAX); - HDassert(dst_n>0); - HDassert(src_n>0); - - H5V_vector_cpy(dst_n, dst_idx, dst_size); - H5V_vector_cpy(src_n, src_idx, src_size); - - for (i=0; i=0 && carry; --j) { - dst += dst_stride[j]; - if (--dst_idx[j]) - carry = FALSE; - else { - HDassert(dst_size); - dst_idx[j] = dst_size[j]; - } /* end else */ - } - for (j=(int)(src_n-1), carry=TRUE; j>=0 && carry; --j) { - src += src_stride[j]; - if (--src_idx[j]) - carry = FALSE; - else { - HDassert(src_size); - src_idx[j] = src_size[j]; - } /* end else */ - } - } - - FUNC_LEAVE_NOAPI_VOID -} -#endif /* LATER */ - - -/*------------------------------------------------------------------------- - * Function: H5V_array_fill - * - * Purpose: Fills all bytes of an array with the same value using - * memset(). Increases amount copied by power of two until the - * halfway point is crossed, then copies the rest in one swoop. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Thursday, June 18, 1998 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -herr_t -H5V_array_fill(void *_dst, const void *src, size_t size, size_t count) -{ - size_t copy_size; /* size of the buffer to copy */ - size_t copy_items; /* number of items currently copying*/ - size_t items_left; /* number of items left to copy */ - uint8_t *dst=(uint8_t*)_dst;/* alias for pointer arithmetic */ - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(dst); - HDassert(src); - HDassert(size < SIZET_MAX && size > 0); - HDassert(count < SIZET_MAX && count > 0); - - HDmemcpy(dst, src, size); /* copy first item */ - - /* Initialize counters, etc. while compensating for first element copied */ - copy_size = size; - copy_items = 1; - items_left = count - 1; - dst += size; - - /* copy until we've copied at least half of the items */ - while (items_left >= copy_items) - { - HDmemcpy(dst, _dst, copy_size); /* copy the current chunk */ - dst += copy_size; /* move the offset for the next chunk */ - items_left -= copy_items; /* decrement the number of items left */ - - copy_size *= 2; /* increase the size of the chunk to copy */ - copy_items *= 2; /* increase the count of items we are copying */ - } /* end while */ - if (items_left > 0) /* if there are any items left to copy */ - HDmemcpy(dst, _dst, items_left * size); - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5V_array_fill() */ - - -/*------------------------------------------------------------------------- - * Function: H5V_array_down - * - * Purpose: Given a set of dimension sizes, calculate the size of each - * "down" slice. This is the size of the dimensions for all the - * dimensions below the current one, which is used for indexing - * offsets in this dimension. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Monday, April 28, 2003 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -herr_t -H5V_array_down(unsigned n, const hsize_t *total_size, hsize_t *down) -{ - hsize_t acc; /*accumulator */ - int i; /*counter */ - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(n <= H5V_HYPER_NDIMS); - HDassert(total_size); - HDassert(down); - - /* Build the sizes of each dimension in the array */ - /* (From fastest to slowest) */ - for(i=(int)(n-1),acc=1; i>=0; i--) { - down[i]=acc; - acc *= total_size[i]; - } /* end for */ - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5V_array_down() */ - - -/*------------------------------------------------------------------------- - * Function: H5V_array_offset_pre - * - * Purpose: Given a coordinate description of a location in an array, this - * function returns the byte offset of the coordinate. - * - * The dimensionality of the whole array, and the offset is N. - * The whole array dimensions are TOTAL_SIZE and the coordinate - * is at offset OFFSET. - * - * Return: Success: Byte offset from beginning of array to element offset - * Failure: abort() -- should never fail - * - * Programmer: Quincey Koziol - * Tuesday, June 22, 1999 - * - * Modifications: - * Use precomputed accumulator array - * Quincey Koziol - * Saturday, April 26, 2003 - * - *------------------------------------------------------------------------- - */ -hsize_t -H5V_array_offset_pre(unsigned n, const hsize_t *acc, const hsize_t *offset) -{ - int i; /*counter */ - hsize_t ret_value; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(n <= H5V_HYPER_NDIMS); - HDassert(acc); - HDassert(offset); - - /* Compute offset in array */ - for (i=(int)(n-1), ret_value=0; i>=0; --i) - ret_value += acc[i] * offset[i]; - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5V_array_offset_pre() */ - - -/*------------------------------------------------------------------------- - * Function: H5V_array_offset - * - * Purpose: Given a coordinate description of a location in an array, this - * function returns the byte offset of the coordinate. - * - * The dimensionality of the whole array, and the offset is N. - * The whole array dimensions are TOTAL_SIZE and the coordinate - * is at offset OFFSET. - * - * Return: Success: Byte offset from beginning of array to element offset - * Failure: abort() -- should never fail - * - * Programmer: Quincey Koziol - * Tuesday, June 22, 1999 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -hsize_t -H5V_array_offset(unsigned n, const hsize_t *total_size, const hsize_t *offset) -{ - hsize_t acc_arr[H5V_HYPER_NDIMS]; /* Accumulated size of down dimensions */ - hsize_t ret_value; /* Return value */ - - FUNC_ENTER_NOAPI((HDabort(), 0)) /*lint !e527 Don't worry about unreachable statement */ - - HDassert(n <= H5V_HYPER_NDIMS); - HDassert(total_size); - HDassert(offset); - - /* Build the sizes of each dimension in the array */ - if(H5V_array_down(n,total_size,acc_arr)<0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, UFAIL, "can't compute down sizes") - - /* Set return value */ - ret_value=H5V_array_offset_pre(n,acc_arr,offset); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5V_array_offset() */ - - -/*------------------------------------------------------------------------- - * Function: H5V_array_calc_pre - * - * Purpose: Given a linear offset in an array, the dimensions of that - * array and the pre-computed 'down' (accumulator) sizes, this - * function computes the coordinates of that offset in the array. - * - * The dimensionality of the whole array, and the coordinates is N. - * The array dimensions are TOTAL_SIZE and the coordinates - * are returned in COORD. The linear offset is in OFFSET. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Thursday, July 16, 2009 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5V_array_calc_pre(hsize_t offset, unsigned n, const hsize_t *down, - hsize_t *coords) -{ - unsigned u; /* Local index variable */ - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - /* Sanity check */ - HDassert(n <= H5V_HYPER_NDIMS); - HDassert(coords); - - /* Compute the coordinates from the offset */ - for(u = 0; u < n; u++) { - coords[u] = offset / down[u]; - offset %= down[u]; - } /* end for */ - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5V_array_calc_pre() */ - - -/*------------------------------------------------------------------------- - * Function: H5V_array_calc - * - * Purpose: Given a linear offset in an array and the dimensions of that - * array, this function computes the coordinates of that offset - * in the array. - * - * The dimensionality of the whole array, and the coordinates is N. - * The array dimensions are TOTAL_SIZE and the coordinates - * are returned in COORD. The linear offset is in OFFSET. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Wednesday, April 16, 2003 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -herr_t -H5V_array_calc(hsize_t offset, unsigned n, const hsize_t *total_size, hsize_t *coords) -{ - hsize_t idx[H5V_HYPER_NDIMS]; /* Size of each dimension in bytes */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity check */ - HDassert(n <= H5V_HYPER_NDIMS); - HDassert(total_size); - HDassert(coords); - - /* Build the sizes of each dimension in the array */ - if(H5V_array_down(n, total_size, idx) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "can't compute down sizes") - - /* Compute the coordinates from the offset */ - if(H5V_array_calc_pre(offset, n, idx, coords) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "can't compute coordinates") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5V_array_calc() */ - - -/*------------------------------------------------------------------------- - * Function: H5V_chunk_index - * - * Purpose: Given a coordinate offset (COORD), the size of each chunk - * (CHUNK), the number of chunks in each dimension (NCHUNKS) - * and the number of dimensions of all of these (NDIMS), calculate - * a "chunk index" for the chunk that the coordinate offset is - * located in. - * - * The chunk index starts at 0 and increases according to the - * fastest changing dimension, then the next fastest, etc. - * - * For example, with a 3x5 chunk size and 6 chunks in the fastest - * changing dimension and 3 chunks in the slowest changing - * dimension, the chunk indices are as follows: - * - * +-----+-----+-----+-----+-----+-----+ - * | | | | | | | - * | 0 | 1 | 2 | 3 | 4 | 5 | - * | | | | | | | - * +-----+-----+-----+-----+-----+-----+ - * | | | | | | | - * | 6 | 7 | 8 | 9 | 10 | 11 | - * | | | | | | | - * +-----+-----+-----+-----+-----+-----+ - * | | | | | | | - * | 12 | 13 | 14 | 15 | 16 | 17 | - * | | | | | | | - * +-----+-----+-----+-----+-----+-----+ - * - * The chunk index is placed in the CHUNK_IDX location for return - * from this function - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Monday, April 21, 2003 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -herr_t -H5V_chunk_index(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, - const hsize_t *down_nchunks, hsize_t *chunk_idx) -{ - hsize_t scaled_coord[H5V_HYPER_NDIMS]; /* Scaled, coordinates, in terms of chunks */ - unsigned u; /* Local index variable */ - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - /* Sanity check */ - HDassert(ndims <= H5V_HYPER_NDIMS); - HDassert(coord); - HDassert(chunk); - HDassert(chunk_idx); - - /* Compute the scaled coordinates for actual coordinates */ - for(u=0; u= max_src_off_ptr) { - /* Roll accumulated changes into appropriate counters */ - *dst_off_ptr = tmp_dst_off; - *dst_len_ptr = tmp_dst_len; - - /* Done with sequences */ - goto finished; - } /* end if */ - tmp_src_off = *src_off_ptr; - - /* Update source information */ - src_len_ptr++; - tmp_src_len = *src_len_ptr; - } while(tmp_src_len < tmp_dst_len); - - /* Roll accumulated sequence lengths into return value */ - ret_value += (ssize_t)acc_len; - - /* Transition to next state */ - if(tmp_dst_len < tmp_src_len) - goto dst_smaller; - else - goto equal; - } /* end if */ - /* Destination sequence is less than source sequence */ - else if(tmp_dst_len < tmp_src_len) { -dst_smaller: - acc_len = 0; - do { - /* Make operator callback */ - if((*op)(tmp_dst_off, tmp_src_off, tmp_dst_len, op_data) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTOPERATE, FAIL, "can't perform operation") - - /* Accumulate number of bytes copied */ - acc_len += tmp_dst_len; - - /* Update source length */ - tmp_src_off += tmp_dst_len; - tmp_src_len -= tmp_dst_len; - - /* Advance destination offset & check for being finished */ - dst_off_ptr++; - if(dst_off_ptr >= max_dst_off_ptr) { - /* Roll accumulated changes into appropriate counters */ - *src_off_ptr = tmp_src_off; - *src_len_ptr = tmp_src_len; - - /* Done with sequences */ - goto finished; - } /* end if */ - tmp_dst_off = *dst_off_ptr; - - /* Update destination information */ - dst_len_ptr++; - tmp_dst_len = *dst_len_ptr; - } while(tmp_dst_len < tmp_src_len); - - /* Roll accumulated sequence lengths into return value */ - ret_value += (ssize_t)acc_len; - - /* Transition to next state */ - if(tmp_src_len < tmp_dst_len) - goto src_smaller; - else - goto equal; - } /* end else-if */ - /* Destination sequence and source sequence are same length */ - else { -equal: - acc_len = 0; - do { - /* Make operator callback */ - if((*op)(tmp_dst_off, tmp_src_off, tmp_dst_len, op_data) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTOPERATE, FAIL, "can't perform operation") - - /* Accumulate number of bytes copied */ - acc_len += tmp_dst_len; - - /* Advance source & destination offset & check for being finished */ - src_off_ptr++; - dst_off_ptr++; - if(src_off_ptr >= max_src_off_ptr || dst_off_ptr >= max_dst_off_ptr) - /* Done with sequences */ - goto finished; - tmp_src_off = *src_off_ptr; - tmp_dst_off = *dst_off_ptr; - - /* Update source information */ - src_len_ptr++; - tmp_src_len = *src_len_ptr; - - /* Update destination information */ - dst_len_ptr++; - tmp_dst_len = *dst_len_ptr; - } while(tmp_dst_len == tmp_src_len); - - /* Roll accumulated sequence lengths into return value */ - ret_value += (ssize_t)acc_len; - - /* Transition to next state */ - if(tmp_dst_len < tmp_src_len) - goto dst_smaller; - else - goto src_smaller; - } /* end else */ - -finished: - /* Roll accumulated sequence lengths into return value */ - ret_value += (ssize_t)acc_len; - - /* Update current sequence vectors */ - *dst_curr_seq = (size_t)(dst_off_ptr - dst_off_arr); - *src_curr_seq = (size_t)(src_off_ptr - src_off_arr); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5V_opvv() */ - - -/*------------------------------------------------------------------------- - * Function: H5V_memcpyvv - * - * Purpose: Given source and destination buffers in memory (SRC & DST) - * copy sequences of from the source buffer into the destination - * buffer. Each set of sequnces has an array of lengths, an - * array of offsets, the maximum number of sequences and the - * current sequence to start at in the sequence. - * - * There may be different numbers of bytes in the source and - * destination sequences, data copying stops when either the - * source or destination buffer runs out of sequence information. - * - * Note: The algorithm in this routine is [basically] the same as for - * H5V_opvv(). Changes should be made to both! - * - * Return: Non-negative # of bytes copied on success/Negative on failure - * - * Programmer: Quincey Koziol - * Friday, May 2, 2003 - * - *------------------------------------------------------------------------- - */ -ssize_t -H5V_memcpyvv(void *_dst, - size_t dst_max_nseq, size_t *dst_curr_seq, size_t dst_len_arr[], hsize_t dst_off_arr[], - const void *_src, - size_t src_max_nseq, size_t *src_curr_seq, size_t src_len_arr[], hsize_t src_off_arr[]) -{ - unsigned char *dst; /* Destination buffer pointer */ - const unsigned char *src; /* Source buffer pointer */ - hsize_t *max_dst_off_ptr, *max_src_off_ptr; /* Pointers to max. source and destination offset locations */ - hsize_t *dst_off_ptr, *src_off_ptr; /* Pointers to source and destination offset arrays */ - size_t *dst_len_ptr, *src_len_ptr; /* Pointers to source and destination length arrays */ - size_t tmp_dst_len; /* Temporary dest. length value */ - size_t tmp_src_len; /* Temporary source length value */ - size_t acc_len; /* Accumulated length of sequences */ - ssize_t ret_value = 0; /* Return value (Total size of sequence in bytes) */ - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - /* Sanity check */ - HDassert(_dst); - HDassert(dst_curr_seq); - HDassert(*dst_curr_seq < dst_max_nseq); - HDassert(dst_len_arr); - HDassert(dst_off_arr); - HDassert(_src); - HDassert(src_curr_seq); - HDassert(*src_curr_seq < src_max_nseq); - HDassert(src_len_arr); - HDassert(src_off_arr); - - /* Set initial offset & length pointers */ - dst_len_ptr = dst_len_arr + *dst_curr_seq; - dst_off_ptr = dst_off_arr + *dst_curr_seq; - src_len_ptr = src_len_arr + *src_curr_seq; - src_off_ptr = src_off_arr + *src_curr_seq; - - /* Get temporary source & destination sequence lengths */ - tmp_dst_len = *dst_len_ptr; - tmp_src_len = *src_len_ptr; - - /* Compute maximum offset pointer values */ - max_dst_off_ptr = dst_off_arr + dst_max_nseq; - max_src_off_ptr = src_off_arr + src_max_nseq; - - /* Compute buffer offsets */ - dst = (unsigned char *)_dst + *dst_off_ptr; - src = (const unsigned char *)_src + *src_off_ptr; - -/* Work through the sequences */ -/* (Choose smallest sequence available initially) */ - - /* Source sequence is less than destination sequence */ - if(tmp_src_len < tmp_dst_len) { -src_smaller: - acc_len = 0; - do { - /* Copy data */ - HDmemcpy(dst, src, tmp_src_len); - - /* Accumulate number of bytes copied */ - acc_len += tmp_src_len; - - /* Update destination length */ - tmp_dst_len -= tmp_src_len; - - /* Advance source offset & check for being finished */ - src_off_ptr++; - if(src_off_ptr >= max_src_off_ptr) { - /* Roll accumulated changes into appropriate counters */ - *dst_off_ptr += acc_len; - *dst_len_ptr = tmp_dst_len; - - /* Done with sequences */ - goto finished; - } /* end if */ - - /* Update destination pointer */ - dst += tmp_src_len; - - /* Update source information */ - src_len_ptr++; - tmp_src_len = *src_len_ptr; - src = (const unsigned char *)_src + *src_off_ptr; - } while(tmp_src_len < tmp_dst_len); - - /* Roll accumulated sequence lengths into return value */ - ret_value += (ssize_t)acc_len; - - /* Transition to next state */ - if(tmp_dst_len < tmp_src_len) - goto dst_smaller; - else - goto equal; - } /* end if */ - /* Destination sequence is less than source sequence */ - else if(tmp_dst_len < tmp_src_len) { -dst_smaller: - acc_len = 0; - do { - /* Copy data */ - HDmemcpy(dst, src, tmp_dst_len); - - /* Accumulate number of bytes copied */ - acc_len += tmp_dst_len; - - /* Update source length */ - tmp_src_len -= tmp_dst_len; - - /* Advance destination offset & check for being finished */ - dst_off_ptr++; - if(dst_off_ptr >= max_dst_off_ptr) { - /* Roll accumulated changes into appropriate counters */ - *src_off_ptr += acc_len; - *src_len_ptr = tmp_src_len; - - /* Done with sequences */ - goto finished; - } /* end if */ - - /* Update source pointer */ - src += tmp_dst_len; - - /* Update destination information */ - dst_len_ptr++; - tmp_dst_len = *dst_len_ptr; - dst = (unsigned char *)_dst + *dst_off_ptr; - } while(tmp_dst_len < tmp_src_len); - - /* Roll accumulated sequence lengths into return value */ - ret_value += (ssize_t)acc_len; - - /* Transition to next state */ - if(tmp_src_len < tmp_dst_len) - goto src_smaller; - else - goto equal; - } /* end else-if */ - /* Destination sequence and source sequence are same length */ - else { -equal: - acc_len = 0; - do { - /* Copy data */ - HDmemcpy(dst, src, tmp_dst_len); - - /* Accumulate number of bytes copied */ - acc_len += tmp_dst_len; - - /* Advance source & destination offset & check for being finished */ - src_off_ptr++; - dst_off_ptr++; - if(src_off_ptr >= max_src_off_ptr || dst_off_ptr >= max_dst_off_ptr) - /* Done with sequences */ - goto finished; - - /* Update source information */ - src_len_ptr++; - tmp_src_len = *src_len_ptr; - src = (const unsigned char *)_src + *src_off_ptr; - - /* Update destination information */ - dst_len_ptr++; - tmp_dst_len = *dst_len_ptr; - dst = (unsigned char *)_dst + *dst_off_ptr; - } while(tmp_dst_len == tmp_src_len); - - /* Roll accumulated sequence lengths into return value */ - ret_value += (ssize_t)acc_len; - - /* Transition to next state */ - if(tmp_dst_len < tmp_src_len) - goto dst_smaller; - else - goto src_smaller; - } /* end else */ - -finished: - /* Roll accumulated sequence lengths into return value */ - ret_value += (ssize_t)acc_len; - - /* Update current sequence vectors */ - *dst_curr_seq = (size_t)(dst_off_ptr - dst_off_arr); - *src_curr_seq = (size_t)(src_off_ptr - src_off_arr); - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5V_memcpyvv() */ - diff --git a/src/H5VM.c b/src/H5VM.c new file mode 100644 index 0000000..6f72c57 --- /dev/null +++ b/src/H5VM.c @@ -0,0 +1,1712 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Robb Matzke + * Friday, October 10, 1997 + */ + + +#include "H5private.h" +#include "H5Eprivate.h" +#include "H5Oprivate.h" +#include "H5VMprivate.h" + +/* Local typedefs */ +typedef struct H5VM_memcpy_ud_t { + unsigned char *dst; /* Pointer to destination buffer */ + const unsigned char *src; /* Pointer to source buffer */ +} H5VM_memcpy_ud_t; + +/* Local macros */ +#define H5VM_HYPER_NDIMS H5O_LAYOUT_NDIMS + +/* Local prototypes */ +static void +H5VM_stride_optimize1(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, + const hsize_t *size, hsize_t *stride1); +static void +H5VM_stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, + const hsize_t *size, hsize_t *stride1, hsize_t *stride2); +#ifdef LATER +static void +H5VM_stride_copy2(hsize_t nelmts, hsize_t elmt_size, + unsigned dst_n, const hsize_t *dst_size, const ssize_t *dst_stride, void *_dst, + unsigned src_n, const hsize_t *src_size, const ssize_t *src_stride, const void *_src); +#endif /* LATER */ + + +/*------------------------------------------------------------------------- + * Function: H5VM_stride_optimize1 + * + * Purpose: Given a stride vector which references elements of the + * specified size, optimize the dimensionality, the stride + * vector, and the element size to minimize the dimensionality + * and the number of memory accesses. + * + * All arguments are passed by reference and their values may be + * modified by this function. + * + * Return: None + * + * Programmer: Robb Matzke + * Saturday, October 11, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void +H5VM_stride_optimize1(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, + const hsize_t *size, hsize_t *stride1) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* + * This has to be true because if we optimize the dimensionality down to + * zero we still must make one reference. + */ + HDassert(1 == H5VM_vector_reduce_product(0, NULL)); + + /* + * Combine adjacent memory accesses + */ + while (*np && stride1[*np-1]>0 && + (hsize_t)(stride1[*np-1])==*elmt_size) { + *elmt_size *= size[*np-1]; + if (--*np) + stride1[*np-1] += size[*np] * stride1[*np]; + } + + FUNC_LEAVE_NOAPI_VOID +} + + +/*------------------------------------------------------------------------- + * Function: H5VM_stride_optimize2 + * + * Purpose: Given two stride vectors which reference elements of the + * specified size, optimize the dimensionality, the stride + * vectors, and the element size to minimize the dimensionality + * and the number of memory accesses. + * + * All arguments are passed by reference and their values may be + * modified by this function. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * Saturday, October 11, 1997 + * + * Modifications: + * Unrolled loops for common cases + * Quincey Koziol + * ?, ? ?, 2001? + * + *------------------------------------------------------------------------- + */ +static void +H5VM_stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, + const hsize_t *size, hsize_t *stride1, hsize_t *stride2) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* + * This has to be true because if we optimize the dimensionality down to + * zero we still must make one reference. + */ + HDassert(1 == H5VM_vector_reduce_product(0, NULL)); + HDassert(*elmt_size>0); + + /* + * Combine adjacent memory accesses + */ + + /* Unroll loop for common cases */ + switch(*np) { + case 1: /* For 0-D datasets (dunno if this ever gets used...) */ + if(stride1[0] == *elmt_size && stride2[0] == *elmt_size) { + *elmt_size *= size[0]; + --*np; /* *np decrements to a value of 0 now */ + } /* end if */ + break; + + case 2: /* For 1-D datasets */ + if(stride1[1] == *elmt_size && stride2[1] == *elmt_size) { + *elmt_size *= size[1]; + --*np; /* *np decrements to a value of 1 now */ + stride1[0] += size[1] * stride1[1]; + stride2[0] += size[1] * stride2[1]; + + if(stride1[0] == *elmt_size && stride2[0] == *elmt_size) { + *elmt_size *= size[0]; + --*np; /* *np decrements to a value of 0 now */ + } /* end if */ + } /* end if */ + break; + + case 3: /* For 2-D datasets */ + if(stride1[2] == *elmt_size && stride2[2] == *elmt_size) { + *elmt_size *= size[2]; + --*np; /* *np decrements to a value of 2 now */ + stride1[1] += size[2] * stride1[2]; + stride2[1] += size[2] * stride2[2]; + + if(stride1[1] == *elmt_size && stride2[1] == *elmt_size) { + *elmt_size *= size[1]; + --*np; /* *np decrements to a value of 1 now */ + stride1[0] += size[1] * stride1[1]; + stride2[0] += size[1] * stride2[1]; + + if(stride1[0] == *elmt_size && stride2[0] == *elmt_size) { + *elmt_size *= size[0]; + --*np; /* *np decrements to a value of 0 now */ + } /* end if */ + } /* end if */ + } /* end if */ + break; + + case 4: /* For 3-D datasets */ + if(stride1[3] == *elmt_size && stride2[3] == *elmt_size) { + *elmt_size *= size[3]; + --*np; /* *np decrements to a value of 3 now */ + stride1[2] += size[3] * stride1[3]; + stride2[2] += size[3] * stride2[3]; + + if(stride1[2] == *elmt_size && stride2[2] == *elmt_size) { + *elmt_size *= size[2]; + --*np; /* *np decrements to a value of 2 now */ + stride1[1] += size[2] * stride1[2]; + stride2[1] += size[2] * stride2[2]; + + if(stride1[1] == *elmt_size && stride2[1] == *elmt_size) { + *elmt_size *= size[1]; + --*np; /* *np decrements to a value of 1 now */ + stride1[0] += size[1] * stride1[1]; + stride2[0] += size[1] * stride2[1]; + + if(stride1[0] == *elmt_size && stride2[0] == *elmt_size) { + *elmt_size *= size[0]; + --*np; /* *np decrements to a value of 0 now */ + } /* end if */ + } /* end if */ + } /* end if */ + } /* end if */ + break; + + default: + while (*np && + stride1[*np-1] == *elmt_size && + stride2[*np-1] == *elmt_size) { + *elmt_size *= size[*np-1]; + if (--*np) { + stride1[*np-1] += size[*np] * stride1[*np]; + stride2[*np-1] += size[*np] * stride2[*np]; + } + } + break; + } /* end switch */ + + FUNC_LEAVE_NOAPI_VOID +} + + +/*------------------------------------------------------------------------- + * Function: H5VM_hyper_stride + * + * Purpose: Given a description of a hyperslab, this function returns + * (through STRIDE[]) the byte strides appropriate for accessing + * all bytes of the hyperslab and the byte offset where the + * striding will begin. The SIZE can be passed to the various + * stride functions. + * + * The dimensionality of the whole array, the hyperslab, and the + * returned stride array is N. The whole array dimensions are + * TOTAL_SIZE and the hyperslab is at offset OFFSET and has + * dimensions SIZE. + * + * The stride and starting point returned will cause the + * hyperslab elements to be referenced in C order. + * + * Return: Success: Byte offset from beginning of array to start + * of striding. + * + * Failure: abort() -- should never fail + * + * Programmer: Robb Matzke + * Saturday, October 11, 1997 + * + * Modifications: + * Unrolled loops for common cases + * Quincey Koziol + * ?, ? ?, 2001? + * + *------------------------------------------------------------------------- + */ +hsize_t +H5VM_hyper_stride(unsigned n, const hsize_t *size, + const hsize_t *total_size, const hsize_t *offset, + hsize_t *stride/*out*/) +{ + hsize_t skip; /*starting point byte offset */ + hsize_t acc; /*accumulator */ + int i; /*counter */ + hsize_t ret_value; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(n <= H5VM_HYPER_NDIMS); + HDassert(size); + HDassert(total_size); + HDassert(stride); + + /* init */ + HDassert(n>0); + stride[n-1] = 1; + skip = offset ? offset[n-1] : 0; + + switch(n) { + case 2: /* 1-D dataset */ + HDassert(total_size[1]>=size[1]); + stride[0] = total_size[1]-size[1]; /*overflow checked*/ + acc = total_size[1]; + skip += acc * (offset ? offset[0] : 0); + break; + + case 3: /* 2-D dataset */ + HDassert(total_size[2]>=size[2]); + stride[1] = total_size[2]-size[2]; /*overflow checked*/ + acc = total_size[2]; + skip += acc * (offset ? (hsize_t)offset[1] : 0); + + HDassert(total_size[1]>=size[1]); + stride[0] = acc * (total_size[1] - size[1]); /*overflow checked*/ + acc *= total_size[1]; + skip += acc * (offset ? (hsize_t)offset[0] : 0); + break; + + case 4: /* 3-D dataset */ + HDassert(total_size[3]>=size[3]); + stride[2] = total_size[3]-size[3]; /*overflow checked*/ + acc = total_size[3]; + skip += acc * (offset ? (hsize_t)offset[2] : 0); + + HDassert(total_size[2]>=size[2]); + stride[1] = acc * (total_size[2] - size[2]); /*overflow checked*/ + acc *= total_size[2]; + skip += acc * (offset ? (hsize_t)offset[1] : 0); + + HDassert(total_size[1]>=size[1]); + stride[0] = acc * (total_size[1] - size[1]); /*overflow checked*/ + acc *= total_size[1]; + skip += acc * (offset ? (hsize_t)offset[0] : 0); + break; + + default: + /* others */ + for (i=(int)(n-2), acc=1; i>=0; --i) { + HDassert(total_size[i+1]>=size[i+1]); + stride[i] = acc * (total_size[i+1] - size[i+1]); /*overflow checked*/ + acc *= total_size[i+1]; + skip += acc * (offset ? (hsize_t)offset[i] : 0); + } + break; + } /* end switch */ + + /* Set return value */ + ret_value=skip; + + FUNC_LEAVE_NOAPI(ret_value) +} + + +/*------------------------------------------------------------------------- + * Function: H5VM_hyper_eq + * + * Purpose: Determines whether two hyperslabs are equal. This function + * assumes that both hyperslabs are relative to the same array, + * for if not, they could not possibly be equal. + * + * Return: Success: TRUE if the hyperslabs are equal (that is, + * both refer to exactly the same elements of an + * array) + * + * FALSE otherwise. + * + * Failure: TRUE the rank is zero or if both hyperslabs + * are of zero size. + * + * Programmer: Robb Matzke + * Friday, October 17, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +htri_t +H5VM_hyper_eq(unsigned n, + const hsize_t *offset1, const hsize_t *size1, + const hsize_t *offset2, const hsize_t *size2) +{ + hsize_t nelmts1 = 1, nelmts2 = 1; + unsigned i; + htri_t ret_value=TRUE; /* Return value */ + + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if (n == 0) HGOTO_DONE(TRUE) + + for (i=0; i 0 && n <= H5VM_HYPER_NDIMS); + HDassert(_size); + HDassert(total_size); + HDassert(dst); +#ifndef NDEBUG + for (u = 0; u < n; u++) { + HDassert(_size[u] > 0); + HDassert(total_size[u] > 0); + } +#endif + + /* Copy the size vector so we can modify it */ + H5VM_vector_cpy(n, size, _size); + + /* Compute an optimal destination stride vector */ + dst_start = H5VM_hyper_stride(n, size, total_size, offset, dst_stride); + H5VM_stride_optimize1(&n, &elmt_size, size, dst_stride); + + /* Copy */ + ret_value = H5VM_stride_fill(n, elmt_size, size, dst_stride, dst+dst_start, + fill_value); + + FUNC_LEAVE_NOAPI(ret_value) +} + + +/*------------------------------------------------------------------------- + * Function: H5VM_hyper_copy + * + * Purpose: Copies a hyperslab from the source to the destination. + * + * A hyperslab is a logically contiguous region of + * multi-dimensional size SIZE of an array whose dimensionality + * is N and whose total size is DST_TOTAL_SIZE or SRC_TOTAL_SIZE. + * The minimum corner of the hyperslab begins at a + * multi-dimensional offset from the minimum corner of the DST + * (destination) or SRC (source) array. The sizes and offsets + * are assumed to be in C order, that is, the first size/offset + * varies the slowest while the last varies the fastest in the + * mapping from N-dimensional space to linear space. This + * function assumes that the array elements are single bytes (if + * your array has multi-byte elements then add an additional + * dimension whose size is that of your element). + * + * The SRC and DST array may be the same array, but the results + * are undefined if the source hyperslab overlaps the + * destination hyperslab. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * Friday, October 10, 1997 + * + * Modifications: + * Unrolled loops for common cases + * Quincey Koziol + * ?, ? ?, 2001? + * + *------------------------------------------------------------------------- + */ +herr_t +H5VM_hyper_copy(unsigned n, const hsize_t *_size, + + /*destination*/ + const hsize_t *dst_size, const hsize_t *dst_offset, + void *_dst, + + /*source*/ + const hsize_t *src_size, const hsize_t *src_offset, + const void *_src) +{ + const uint8_t *src = (const uint8_t*)_src; /*cast for ptr arithmtc */ + uint8_t *dst = (uint8_t*) _dst; /*cast for ptr arithmtc */ + hsize_t size[H5VM_HYPER_NDIMS]; /*a modifiable _size */ + hsize_t src_stride[H5VM_HYPER_NDIMS]; /*source stride info */ + hsize_t dst_stride[H5VM_HYPER_NDIMS]; /*dest stride info */ + hsize_t dst_start, src_start; /*offset to start at */ + hsize_t elmt_size = 1; /*element size in bytes */ + herr_t ret_value; /*return status */ +#ifndef NDEBUG + unsigned u; +#endif + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* check args */ + HDassert(n > 0 && n <= H5VM_HYPER_NDIMS); + HDassert(_size); + HDassert(dst_size); + HDassert(src_size); + HDassert(dst); + HDassert(src); +#ifndef NDEBUG + for (u = 0; u < n; u++) { + HDassert(_size[u] > 0); + HDassert(dst_size[u] > 0); + HDassert(src_size[u] > 0); + } +#endif + + /* Copy the size vector so we can modify it */ + H5VM_vector_cpy(n, size, _size); + + /* Compute stride vectors for source and destination */ +#ifdef NO_INLINED_CODE + dst_start = H5VM_hyper_stride(n, size, dst_size, dst_offset, dst_stride); + src_start = H5VM_hyper_stride(n, size, src_size, src_offset, src_stride); +#else /* NO_INLINED_CODE */ + /* in-line version of two calls to H5VM_hyper_stride() */ + { + hsize_t dst_acc; /*accumulator */ + hsize_t src_acc; /*accumulator */ + int ii; /*counter */ + + /* init */ + HDassert(n>0); + dst_stride[n-1] = 1; + src_stride[n-1] = 1; + dst_start = dst_offset ? dst_offset[n-1] : 0; + src_start = src_offset ? src_offset[n-1] : 0; + + /* Unroll loop for common cases */ + switch(n) { + case 2: + HDassert(dst_size[1]>=size[1]); + HDassert(src_size[1]>=size[1]); + dst_stride[0] = dst_size[1] - size[1]; /*overflow checked*/ + src_stride[0] = src_size[1] - size[1]; /*overflow checked*/ + dst_acc = dst_size[1]; + src_acc = src_size[1]; + dst_start += dst_acc * (dst_offset ? dst_offset[0] : 0); + src_start += src_acc * (src_offset ? src_offset[0] : 0); + break; + + case 3: + HDassert(dst_size[2]>=size[2]); + HDassert(src_size[2]>=size[2]); + dst_stride[1] = dst_size[2] - size[2]; /*overflow checked*/ + src_stride[1] = src_size[2] - size[2]; /*overflow checked*/ + dst_acc = dst_size[2]; + src_acc = src_size[2]; + dst_start += dst_acc * (dst_offset ? dst_offset[1] : 0); + src_start += src_acc * (src_offset ? src_offset[1] : 0); + + HDassert(dst_size[1]>=size[1]); + HDassert(src_size[1]>=size[1]); + dst_stride[0] = dst_acc * (dst_size[1] - size[1]); /*overflow checked*/ + src_stride[0] = src_acc * (src_size[1] - size[1]); /*overflow checked*/ + dst_acc *= dst_size[1]; + src_acc *= src_size[1]; + dst_start += dst_acc * (dst_offset ? dst_offset[0] : 0); + src_start += src_acc * (src_offset ? src_offset[0] : 0); + break; + + case 4: + HDassert(dst_size[3]>=size[3]); + HDassert(src_size[3]>=size[3]); + dst_stride[2] = dst_size[3] - size[3]; /*overflow checked*/ + src_stride[2] = src_size[3] - size[3]; /*overflow checked*/ + dst_acc = dst_size[3]; + src_acc = src_size[3]; + dst_start += dst_acc * (dst_offset ? dst_offset[2] : 0); + src_start += src_acc * (src_offset ? src_offset[2] : 0); + + HDassert(dst_size[2]>=size[2]); + HDassert(src_size[2]>=size[2]); + dst_stride[1] = dst_acc * (dst_size[2] - size[2]); /*overflow checked*/ + src_stride[1] = src_acc * (src_size[2] - size[2]); /*overflow checked*/ + dst_acc *= dst_size[2]; + src_acc *= src_size[2]; + dst_start += dst_acc * (dst_offset ? dst_offset[1] : 0); + src_start += src_acc * (src_offset ? src_offset[1] : 0); + + HDassert(dst_size[1]>=size[1]); + HDassert(src_size[1]>=size[1]); + dst_stride[0] = dst_acc * (dst_size[1] - size[1]); /*overflow checked*/ + src_stride[0] = src_acc * (src_size[1] - size[1]); /*overflow checked*/ + dst_acc *= dst_size[1]; + src_acc *= src_size[1]; + dst_start += dst_acc * (dst_offset ? dst_offset[0] : 0); + src_start += src_acc * (src_offset ? src_offset[0] : 0); + break; + + default: + /* others */ + for (ii=(int)(n-2), dst_acc=1, src_acc=1; ii>=0; --ii) { + HDassert(dst_size[ii+1]>=size[ii+1]); + HDassert(src_size[ii+1]>=size[ii+1]); + dst_stride[ii] = dst_acc * (dst_size[ii+1] - size[ii+1]); /*overflow checked*/ + src_stride[ii] = src_acc * (src_size[ii+1] - size[ii+1]); /*overflow checked*/ + dst_acc *= dst_size[ii+1]; + src_acc *= src_size[ii+1]; + dst_start += dst_acc * (dst_offset ? dst_offset[ii] : 0); + src_start += src_acc * (src_offset ? src_offset[ii] : 0); + } + break; + } /* end switch */ + } +#endif /* NO_INLINED_CODE */ + + /* Optimize the strides as a pair */ + H5VM_stride_optimize2(&n, &elmt_size, size, dst_stride, src_stride); + + /* Perform the copy in terms of stride */ + ret_value = H5VM_stride_copy(n, elmt_size, size, + dst_stride, dst+dst_start, src_stride, src+src_start); + + FUNC_LEAVE_NOAPI(ret_value) +} + + +/*------------------------------------------------------------------------- + * Function: H5VM_stride_fill + * + * Purpose: Fills all bytes of a hyperslab with the same value using + * memset(). + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * Saturday, October 11, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5VM_stride_fill(unsigned n, hsize_t elmt_size, const hsize_t *size, + const hsize_t *stride, void *_dst, unsigned fill_value) +{ + uint8_t *dst = (uint8_t*)_dst; /*cast for ptr arithmetic */ + hsize_t idx[H5VM_HYPER_NDIMS]; /*1-origin indices */ + hsize_t nelmts; /*number of elements to fill */ + hsize_t i; /*counter */ + int j; /*counter */ + hbool_t carry; /*subtraction carray value */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(elmt_size < SIZET_MAX); + + H5VM_vector_cpy(n, idx, size); + nelmts = H5VM_vector_reduce_product(n, size); + for (i=0; i=0 && carry; --j) { + dst += stride[j]; + + if (--idx[j]) + carry = FALSE; + else { + HDassert(size); + idx[j] = size[j]; + } /* end else */ + } + } + + FUNC_LEAVE_NOAPI(SUCCEED) +} + + +/*------------------------------------------------------------------------- + * Function: H5VM_stride_copy + * + * Purpose: Uses DST_STRIDE and SRC_STRIDE to advance through the arrays + * DST and SRC while copying bytes from SRC to DST. This + * function minimizes the number of calls to memcpy() by + * combining various strides, but it will never touch memory + * outside the hyperslab defined by the strides. + * + * Note: If the src_stride is all zero and elmt_size is one, then it's + * probably more efficient to use H5VM_stride_fill() instead. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * Saturday, October 11, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5VM_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size, + const hsize_t *dst_stride, void *_dst, + const hsize_t *src_stride, const void *_src) +{ + uint8_t *dst = (uint8_t*)_dst; /*cast for ptr arithmetic*/ + const uint8_t *src = (const uint8_t*) _src; /*cast for ptr arithmetic*/ + hsize_t idx[H5VM_HYPER_NDIMS]; /*1-origin indices */ + hsize_t nelmts; /*num elements to copy */ + hsize_t i; /*counter */ + int j; /*counters */ + hbool_t carry; /*carray for subtraction*/ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(elmt_size=0 && carry; --j) { + src += src_stride[j]; + dst += dst_stride[j]; + + if (--idx[j]) + carry = FALSE; + else { + HDassert(size); + idx[j] = size[j]; + } + } + } + } else { + H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t); + HDmemcpy (dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */ + } + + FUNC_LEAVE_NOAPI(SUCCEED) +} + + +/*------------------------------------------------------------------------- + * Function: H5VM_stride_copy_s + * + * Purpose: Uses DST_STRIDE and SRC_STRIDE to advance through the arrays + * DST and SRC while copying bytes from SRC to DST. This + * function minimizes the number of calls to memcpy() by + * combining various strides, but it will never touch memory + * outside the hyperslab defined by the strides. + * + * Note: If the src_stride is all zero and elmt_size is one, then it's + * probably more efficient to use H5VM_stride_fill() instead. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * Saturday, October 11, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size, + const hssize_t *dst_stride, void *_dst, + const hssize_t *src_stride, const void *_src) +{ + uint8_t *dst = (uint8_t*)_dst; /*cast for ptr arithmetic*/ + const uint8_t *src = (const uint8_t*) _src; /*cast for ptr arithmetic*/ + hsize_t idx[H5VM_HYPER_NDIMS]; /*1-origin indices */ + hsize_t nelmts; /*num elements to copy */ + hsize_t i; /*counter */ + int j; /*counters */ + hbool_t carry; /*carray for subtraction*/ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(elmt_size=0 && carry; --j) { + src += src_stride[j]; + dst += dst_stride[j]; + + if (--idx[j]) + carry = FALSE; + else { + HDassert(size); + idx[j] = size[j]; + } + } + } + } else { + H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t); + HDmemcpy (dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */ + } + + FUNC_LEAVE_NOAPI(SUCCEED) +} + +#ifdef LATER + +/*------------------------------------------------------------------------- + * Function: H5VM_stride_copy2 + * + * Purpose: Similar to H5VM_stride_copy() except the source and + * destination each have their own dimensionality and size and + * we copy exactly NELMTS elements each of size ELMT_SIZE. The + * size counters wrap if NELMTS is more than a size counter. + * + * Return: None + * + * Programmer: Robb Matzke + * Saturday, October 11, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void +H5VM_stride_copy2(hsize_t nelmts, hsize_t elmt_size, + + /* destination */ + unsigned dst_n, const hsize_t *dst_size, + const hsize_t *dst_stride, + void *_dst, + + /* source */ + unsigned src_n, const hsize_t *src_size, + const hsize_t *src_stride, + const void *_src) +{ + uint8_t *dst = (uint8_t *) _dst; + const uint8_t *src = (const uint8_t *) _src; + hsize_t dst_idx[H5VM_HYPER_NDIMS]; + hsize_t src_idx[H5VM_HYPER_NDIMS]; + hsize_t i; /* Local index variable */ + int j; /* Local index variable */ + hbool_t carry; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(elmt_size < SIZET_MAX); + HDassert(dst_n>0); + HDassert(src_n>0); + + H5VM_vector_cpy(dst_n, dst_idx, dst_size); + H5VM_vector_cpy(src_n, src_idx, src_size); + + for (i=0; i=0 && carry; --j) { + dst += dst_stride[j]; + if (--dst_idx[j]) + carry = FALSE; + else { + HDassert(dst_size); + dst_idx[j] = dst_size[j]; + } /* end else */ + } + for (j=(int)(src_n-1), carry=TRUE; j>=0 && carry; --j) { + src += src_stride[j]; + if (--src_idx[j]) + carry = FALSE; + else { + HDassert(src_size); + src_idx[j] = src_size[j]; + } /* end else */ + } + } + + FUNC_LEAVE_NOAPI_VOID +} +#endif /* LATER */ + + +/*------------------------------------------------------------------------- + * Function: H5VM_array_fill + * + * Purpose: Fills all bytes of an array with the same value using + * memset(). Increases amount copied by power of two until the + * halfway point is crossed, then copies the rest in one swoop. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, June 18, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count) +{ + size_t copy_size; /* size of the buffer to copy */ + size_t copy_items; /* number of items currently copying*/ + size_t items_left; /* number of items left to copy */ + uint8_t *dst=(uint8_t*)_dst;/* alias for pointer arithmetic */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(dst); + HDassert(src); + HDassert(size < SIZET_MAX && size > 0); + HDassert(count < SIZET_MAX && count > 0); + + HDmemcpy(dst, src, size); /* copy first item */ + + /* Initialize counters, etc. while compensating for first element copied */ + copy_size = size; + copy_items = 1; + items_left = count - 1; + dst += size; + + /* copy until we've copied at least half of the items */ + while (items_left >= copy_items) + { + HDmemcpy(dst, _dst, copy_size); /* copy the current chunk */ + dst += copy_size; /* move the offset for the next chunk */ + items_left -= copy_items; /* decrement the number of items left */ + + copy_size *= 2; /* increase the size of the chunk to copy */ + copy_items *= 2; /* increase the count of items we are copying */ + } /* end while */ + if (items_left > 0) /* if there are any items left to copy */ + HDmemcpy(dst, _dst, items_left * size); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5VM_array_fill() */ + + +/*------------------------------------------------------------------------- + * Function: H5VM_array_down + * + * Purpose: Given a set of dimension sizes, calculate the size of each + * "down" slice. This is the size of the dimensions for all the + * dimensions below the current one, which is used for indexing + * offsets in this dimension. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Monday, April 28, 2003 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5VM_array_down(unsigned n, const hsize_t *total_size, hsize_t *down) +{ + hsize_t acc; /*accumulator */ + int i; /*counter */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(n <= H5VM_HYPER_NDIMS); + HDassert(total_size); + HDassert(down); + + /* Build the sizes of each dimension in the array */ + /* (From fastest to slowest) */ + for(i=(int)(n-1),acc=1; i>=0; i--) { + down[i]=acc; + acc *= total_size[i]; + } /* end for */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5VM_array_down() */ + + +/*------------------------------------------------------------------------- + * Function: H5VM_array_offset_pre + * + * Purpose: Given a coordinate description of a location in an array, this + * function returns the byte offset of the coordinate. + * + * The dimensionality of the whole array, and the offset is N. + * The whole array dimensions are TOTAL_SIZE and the coordinate + * is at offset OFFSET. + * + * Return: Success: Byte offset from beginning of array to element offset + * Failure: abort() -- should never fail + * + * 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 */ + hsize_t ret_value; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(n <= H5VM_HYPER_NDIMS); + HDassert(acc); + HDassert(offset); + + /* Compute offset in array */ + for (i=(int)(n-1), ret_value=0; i>=0; --i) + ret_value += acc[i] * offset[i]; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VM_array_offset_pre() */ + + +/*------------------------------------------------------------------------- + * Function: H5VM_array_offset + * + * Purpose: Given a coordinate description of a location in an array, this + * function returns the byte offset of the coordinate. + * + * The dimensionality of the whole array, and the offset is N. + * The whole array dimensions are TOTAL_SIZE and the coordinate + * is at offset OFFSET. + * + * Return: Success: Byte offset from beginning of array to element offset + * Failure: abort() -- should never fail + * + * Programmer: Quincey Koziol + * Tuesday, June 22, 1999 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +hsize_t +H5VM_array_offset(unsigned n, const hsize_t *total_size, const hsize_t *offset) +{ + hsize_t acc_arr[H5VM_HYPER_NDIMS]; /* Accumulated size of down dimensions */ + hsize_t ret_value; /* Return value */ + + FUNC_ENTER_NOAPI((HDabort(), 0)) /*lint !e527 Don't worry about unreachable statement */ + + HDassert(n <= H5VM_HYPER_NDIMS); + HDassert(total_size); + HDassert(offset); + + /* Build the sizes of each dimension in the array */ + if(H5VM_array_down(n,total_size,acc_arr)<0) + HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, UFAIL, "can't compute down sizes") + + /* Set return value */ + ret_value=H5VM_array_offset_pre(n,acc_arr,offset); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VM_array_offset() */ + + +/*------------------------------------------------------------------------- + * Function: H5VM_array_calc_pre + * + * Purpose: Given a linear offset in an array, the dimensions of that + * array and the pre-computed 'down' (accumulator) sizes, this + * function computes the coordinates of that offset in the array. + * + * The dimensionality of the whole array, and the coordinates is N. + * The array dimensions are TOTAL_SIZE and the coordinates + * are returned in COORD. The linear offset is in OFFSET. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, July 16, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VM_array_calc_pre(hsize_t offset, unsigned n, const hsize_t *down, + hsize_t *coords) +{ + unsigned u; /* Local index variable */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity check */ + HDassert(n <= H5VM_HYPER_NDIMS); + HDassert(coords); + + /* Compute the coordinates from the offset */ + for(u = 0; u < n; u++) { + coords[u] = offset / down[u]; + offset %= down[u]; + } /* end for */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5VM_array_calc_pre() */ + + +/*------------------------------------------------------------------------- + * Function: H5VM_array_calc + * + * Purpose: Given a linear offset in an array and the dimensions of that + * array, this function computes the coordinates of that offset + * in the array. + * + * The dimensionality of the whole array, and the coordinates is N. + * The array dimensions are TOTAL_SIZE and the coordinates + * are returned in COORD. The linear offset is in OFFSET. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Wednesday, April 16, 2003 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5VM_array_calc(hsize_t offset, unsigned n, const hsize_t *total_size, hsize_t *coords) +{ + hsize_t idx[H5VM_HYPER_NDIMS]; /* Size of each dimension in bytes */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(n <= H5VM_HYPER_NDIMS); + HDassert(total_size); + HDassert(coords); + + /* Build the sizes of each dimension in the array */ + if(H5VM_array_down(n, total_size, idx) < 0) + HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "can't compute down sizes") + + /* Compute the coordinates from the offset */ + if(H5VM_array_calc_pre(offset, n, idx, coords) < 0) + HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "can't compute coordinates") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VM_array_calc() */ + + +/*------------------------------------------------------------------------- + * Function: H5VM_chunk_index + * + * Purpose: Given a coordinate offset (COORD), the size of each chunk + * (CHUNK), the number of chunks in each dimension (NCHUNKS) + * and the number of dimensions of all of these (NDIMS), calculate + * a "chunk index" for the chunk that the coordinate offset is + * located in. + * + * The chunk index starts at 0 and increases according to the + * fastest changing dimension, then the next fastest, etc. + * + * For example, with a 3x5 chunk size and 6 chunks in the fastest + * changing dimension and 3 chunks in the slowest changing + * dimension, the chunk indices are as follows: + * + * +-----+-----+-----+-----+-----+-----+ + * | | | | | | | + * | 0 | 1 | 2 | 3 | 4 | 5 | + * | | | | | | | + * +-----+-----+-----+-----+-----+-----+ + * | | | | | | | + * | 6 | 7 | 8 | 9 | 10 | 11 | + * | | | | | | | + * +-----+-----+-----+-----+-----+-----+ + * | | | | | | | + * | 12 | 13 | 14 | 15 | 16 | 17 | + * | | | | | | | + * +-----+-----+-----+-----+-----+-----+ + * + * The chunk index is placed in the CHUNK_IDX location for return + * from this function + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Monday, April 21, 2003 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5VM_chunk_index(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, + const hsize_t *down_nchunks, hsize_t *chunk_idx) +{ + hsize_t scaled_coord[H5VM_HYPER_NDIMS]; /* Scaled, coordinates, in terms of chunks */ + unsigned u; /* Local index variable */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity check */ + HDassert(ndims <= H5VM_HYPER_NDIMS); + HDassert(coord); + HDassert(chunk); + HDassert(chunk_idx); + + /* Compute the scaled coordinates for actual coordinates */ + for(u=0; u= max_src_off_ptr) { + /* Roll accumulated changes into appropriate counters */ + *dst_off_ptr = tmp_dst_off; + *dst_len_ptr = tmp_dst_len; + + /* Done with sequences */ + goto finished; + } /* end if */ + tmp_src_off = *src_off_ptr; + + /* Update source information */ + src_len_ptr++; + tmp_src_len = *src_len_ptr; + } while(tmp_src_len < tmp_dst_len); + + /* Roll accumulated sequence lengths into return value */ + ret_value += (ssize_t)acc_len; + + /* Transition to next state */ + if(tmp_dst_len < tmp_src_len) + goto dst_smaller; + else + goto equal; + } /* end if */ + /* Destination sequence is less than source sequence */ + else if(tmp_dst_len < tmp_src_len) { +dst_smaller: + acc_len = 0; + do { + /* Make operator callback */ + if((*op)(tmp_dst_off, tmp_src_off, tmp_dst_len, op_data) < 0) + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTOPERATE, FAIL, "can't perform operation") + + /* Accumulate number of bytes copied */ + acc_len += tmp_dst_len; + + /* Update source length */ + tmp_src_off += tmp_dst_len; + tmp_src_len -= tmp_dst_len; + + /* Advance destination offset & check for being finished */ + dst_off_ptr++; + if(dst_off_ptr >= max_dst_off_ptr) { + /* Roll accumulated changes into appropriate counters */ + *src_off_ptr = tmp_src_off; + *src_len_ptr = tmp_src_len; + + /* Done with sequences */ + goto finished; + } /* end if */ + tmp_dst_off = *dst_off_ptr; + + /* Update destination information */ + dst_len_ptr++; + tmp_dst_len = *dst_len_ptr; + } while(tmp_dst_len < tmp_src_len); + + /* Roll accumulated sequence lengths into return value */ + ret_value += (ssize_t)acc_len; + + /* Transition to next state */ + if(tmp_src_len < tmp_dst_len) + goto src_smaller; + else + goto equal; + } /* end else-if */ + /* Destination sequence and source sequence are same length */ + else { +equal: + acc_len = 0; + do { + /* Make operator callback */ + if((*op)(tmp_dst_off, tmp_src_off, tmp_dst_len, op_data) < 0) + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTOPERATE, FAIL, "can't perform operation") + + /* Accumulate number of bytes copied */ + acc_len += tmp_dst_len; + + /* Advance source & destination offset & check for being finished */ + src_off_ptr++; + dst_off_ptr++; + if(src_off_ptr >= max_src_off_ptr || dst_off_ptr >= max_dst_off_ptr) + /* Done with sequences */ + goto finished; + tmp_src_off = *src_off_ptr; + tmp_dst_off = *dst_off_ptr; + + /* Update source information */ + src_len_ptr++; + tmp_src_len = *src_len_ptr; + + /* Update destination information */ + dst_len_ptr++; + tmp_dst_len = *dst_len_ptr; + } while(tmp_dst_len == tmp_src_len); + + /* Roll accumulated sequence lengths into return value */ + ret_value += (ssize_t)acc_len; + + /* Transition to next state */ + if(tmp_dst_len < tmp_src_len) + goto dst_smaller; + else + goto src_smaller; + } /* end else */ + +finished: + /* Roll accumulated sequence lengths into return value */ + ret_value += (ssize_t)acc_len; + + /* Update current sequence vectors */ + *dst_curr_seq = (size_t)(dst_off_ptr - dst_off_arr); + *src_curr_seq = (size_t)(src_off_ptr - src_off_arr); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VM_opvv() */ + + +/*------------------------------------------------------------------------- + * Function: H5VM_memcpyvv + * + * Purpose: Given source and destination buffers in memory (SRC & DST) + * copy sequences of from the source buffer into the destination + * buffer. Each set of sequnces has an array of lengths, an + * array of offsets, the maximum number of sequences and the + * current sequence to start at in the sequence. + * + * There may be different numbers of bytes in the source and + * destination sequences, data copying stops when either the + * source or destination buffer runs out of sequence information. + * + * Note: The algorithm in this routine is [basically] the same as for + * H5VM_opvv(). Changes should be made to both! + * + * Return: Non-negative # of bytes copied on success/Negative on failure + * + * Programmer: Quincey Koziol + * Friday, May 2, 2003 + * + *------------------------------------------------------------------------- + */ +ssize_t +H5VM_memcpyvv(void *_dst, + size_t dst_max_nseq, size_t *dst_curr_seq, size_t dst_len_arr[], hsize_t dst_off_arr[], + const void *_src, + size_t src_max_nseq, size_t *src_curr_seq, size_t src_len_arr[], hsize_t src_off_arr[]) +{ + unsigned char *dst; /* Destination buffer pointer */ + const unsigned char *src; /* Source buffer pointer */ + hsize_t *max_dst_off_ptr, *max_src_off_ptr; /* Pointers to max. source and destination offset locations */ + hsize_t *dst_off_ptr, *src_off_ptr; /* Pointers to source and destination offset arrays */ + size_t *dst_len_ptr, *src_len_ptr; /* Pointers to source and destination length arrays */ + size_t tmp_dst_len; /* Temporary dest. length value */ + size_t tmp_src_len; /* Temporary source length value */ + size_t acc_len; /* Accumulated length of sequences */ + ssize_t ret_value = 0; /* Return value (Total size of sequence in bytes) */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity check */ + HDassert(_dst); + HDassert(dst_curr_seq); + HDassert(*dst_curr_seq < dst_max_nseq); + HDassert(dst_len_arr); + HDassert(dst_off_arr); + HDassert(_src); + HDassert(src_curr_seq); + HDassert(*src_curr_seq < src_max_nseq); + HDassert(src_len_arr); + HDassert(src_off_arr); + + /* Set initial offset & length pointers */ + dst_len_ptr = dst_len_arr + *dst_curr_seq; + dst_off_ptr = dst_off_arr + *dst_curr_seq; + src_len_ptr = src_len_arr + *src_curr_seq; + src_off_ptr = src_off_arr + *src_curr_seq; + + /* Get temporary source & destination sequence lengths */ + tmp_dst_len = *dst_len_ptr; + tmp_src_len = *src_len_ptr; + + /* Compute maximum offset pointer values */ + max_dst_off_ptr = dst_off_arr + dst_max_nseq; + max_src_off_ptr = src_off_arr + src_max_nseq; + + /* Compute buffer offsets */ + dst = (unsigned char *)_dst + *dst_off_ptr; + src = (const unsigned char *)_src + *src_off_ptr; + +/* Work through the sequences */ +/* (Choose smallest sequence available initially) */ + + /* Source sequence is less than destination sequence */ + if(tmp_src_len < tmp_dst_len) { +src_smaller: + acc_len = 0; + do { + /* Copy data */ + HDmemcpy(dst, src, tmp_src_len); + + /* Accumulate number of bytes copied */ + acc_len += tmp_src_len; + + /* Update destination length */ + tmp_dst_len -= tmp_src_len; + + /* Advance source offset & check for being finished */ + src_off_ptr++; + if(src_off_ptr >= max_src_off_ptr) { + /* Roll accumulated changes into appropriate counters */ + *dst_off_ptr += acc_len; + *dst_len_ptr = tmp_dst_len; + + /* Done with sequences */ + goto finished; + } /* end if */ + + /* Update destination pointer */ + dst += tmp_src_len; + + /* Update source information */ + src_len_ptr++; + tmp_src_len = *src_len_ptr; + src = (const unsigned char *)_src + *src_off_ptr; + } while(tmp_src_len < tmp_dst_len); + + /* Roll accumulated sequence lengths into return value */ + ret_value += (ssize_t)acc_len; + + /* Transition to next state */ + if(tmp_dst_len < tmp_src_len) + goto dst_smaller; + else + goto equal; + } /* end if */ + /* Destination sequence is less than source sequence */ + else if(tmp_dst_len < tmp_src_len) { +dst_smaller: + acc_len = 0; + do { + /* Copy data */ + HDmemcpy(dst, src, tmp_dst_len); + + /* Accumulate number of bytes copied */ + acc_len += tmp_dst_len; + + /* Update source length */ + tmp_src_len -= tmp_dst_len; + + /* Advance destination offset & check for being finished */ + dst_off_ptr++; + if(dst_off_ptr >= max_dst_off_ptr) { + /* Roll accumulated changes into appropriate counters */ + *src_off_ptr += acc_len; + *src_len_ptr = tmp_src_len; + + /* Done with sequences */ + goto finished; + } /* end if */ + + /* Update source pointer */ + src += tmp_dst_len; + + /* Update destination information */ + dst_len_ptr++; + tmp_dst_len = *dst_len_ptr; + dst = (unsigned char *)_dst + *dst_off_ptr; + } while(tmp_dst_len < tmp_src_len); + + /* Roll accumulated sequence lengths into return value */ + ret_value += (ssize_t)acc_len; + + /* Transition to next state */ + if(tmp_src_len < tmp_dst_len) + goto src_smaller; + else + goto equal; + } /* end else-if */ + /* Destination sequence and source sequence are same length */ + else { +equal: + acc_len = 0; + do { + /* Copy data */ + HDmemcpy(dst, src, tmp_dst_len); + + /* Accumulate number of bytes copied */ + acc_len += tmp_dst_len; + + /* Advance source & destination offset & check for being finished */ + src_off_ptr++; + dst_off_ptr++; + if(src_off_ptr >= max_src_off_ptr || dst_off_ptr >= max_dst_off_ptr) + /* Done with sequences */ + goto finished; + + /* Update source information */ + src_len_ptr++; + tmp_src_len = *src_len_ptr; + src = (const unsigned char *)_src + *src_off_ptr; + + /* Update destination information */ + dst_len_ptr++; + tmp_dst_len = *dst_len_ptr; + dst = (unsigned char *)_dst + *dst_off_ptr; + } while(tmp_dst_len == tmp_src_len); + + /* Roll accumulated sequence lengths into return value */ + ret_value += (ssize_t)acc_len; + + /* Transition to next state */ + if(tmp_dst_len < tmp_src_len) + goto dst_smaller; + else + goto src_smaller; + } /* end else */ + +finished: + /* Roll accumulated sequence lengths into return value */ + ret_value += (ssize_t)acc_len; + + /* Update current sequence vectors */ + *dst_curr_seq = (size_t)(dst_off_ptr - dst_off_arr); + *src_curr_seq = (size_t)(src_off_ptr - src_off_arr); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VM_memcpyvv() */ + diff --git a/src/H5VMprivate.h b/src/H5VMprivate.h new file mode 100644 index 0000000..4706b5f --- /dev/null +++ b/src/H5VMprivate.h @@ -0,0 +1,501 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Robb Matzke + * Friday, October 10, 1997 + */ +#ifndef H5VMprivate_H +#define H5VMprivate_H + +/* Private headers needed by this file */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ + +/* Vector-Vector sequence operation callback */ +typedef herr_t (*H5VM_opvv_func_t)(hsize_t dst_off, hsize_t src_off, + size_t len, void *udata); + +/* Vector comparison functions like Fortran66 comparison operators */ +#define H5VM_vector_eq_s(N,V1,V2) (H5VM_vector_cmp_s (N, V1, V2)==0) +#define H5VM_vector_lt_s(N,V1,V2) (H5VM_vector_cmp_s (N, V1, V2)<0) +#define H5VM_vector_gt_s(N,V1,V2) (H5VM_vector_cmp_s (N, V1, V2)>0) +#define H5VM_vector_le_s(N,V1,V2) (H5VM_vector_cmp_s (N, V1, V2)<=0) +#define H5VM_vector_ge_s(N,V1,V2) (H5VM_vector_cmp_s (N, V1, V2)>=0) +#define H5VM_vector_eq_u(N,V1,V2) (H5VM_vector_cmp_u (N, V1, V2)==0) +#define H5VM_vector_lt_u(N,V1,V2) (H5VM_vector_cmp_u (N, V1, V2)<0) +#define H5VM_vector_gt_u(N,V1,V2) (H5VM_vector_cmp_u (N, V1, V2)>0) +#define H5VM_vector_le_u(N,V1,V2) (H5VM_vector_cmp_u (N, V1, V2)<=0) +#define H5VM_vector_ge_u(N,V1,V2) (H5VM_vector_cmp_u (N, V1, V2)>=0) + +/* Other functions */ +#define H5VM_vector_cpy(N,DST,SRC) { \ + HDassert(sizeof(*(DST))==sizeof(*(SRC))); \ + if (SRC) HDmemcpy (DST, SRC, (N)*sizeof(*(DST))); \ + else HDmemset (DST, 0, (N)*sizeof(*(DST))); \ +} + +#define H5VM_vector_zero(N,DST) HDmemset(DST,0,(N)*sizeof(*(DST))) + +/* A null pointer is equivalent to a zero vector */ +#define H5VM_ZERO NULL + +H5_DLL hsize_t H5VM_hyper_stride(unsigned n, const hsize_t *size, + const hsize_t *total_size, + const hsize_t *offset, + hsize_t *stride); +H5_DLL htri_t H5VM_hyper_disjointp(unsigned n, const hsize_t *offset1, + const uint32_t *size1, const hsize_t *offset2, const uint32_t *size2); +H5_DLL htri_t H5VM_hyper_eq(unsigned n, const hsize_t *offset1, + const hsize_t *size1, const hsize_t *offset2, + const hsize_t *size2); +H5_DLL herr_t H5VM_hyper_fill(unsigned n, const hsize_t *_size, + const hsize_t *total_size, + const hsize_t *offset, void *_dst, + unsigned fill_value); +H5_DLL herr_t H5VM_hyper_copy(unsigned n, const hsize_t *size, + const hsize_t *dst_total_size, + const hsize_t *dst_offset, void *_dst, + const hsize_t *src_total_size, + const hsize_t *src_offset, const void *_src); +H5_DLL herr_t H5VM_stride_fill(unsigned n, hsize_t elmt_size, const hsize_t *size, + const hsize_t *stride, void *_dst, + unsigned fill_value); +H5_DLL herr_t H5VM_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *_size, + const hsize_t *dst_stride, void *_dst, + const hsize_t *src_stride, const void *_src); +H5_DLL herr_t H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *_size, + const hssize_t *dst_stride, void *_dst, + const hssize_t *src_stride, const void *_src); +H5_DLL herr_t H5VM_array_fill(void *_dst, const void *src, size_t size, + size_t count); +H5_DLL herr_t H5VM_array_down(unsigned n, const hsize_t *total_size, + hsize_t *down); +H5_DLL hsize_t H5VM_array_offset_pre(unsigned n, + const hsize_t *acc, const hsize_t *offset); +H5_DLL hsize_t H5VM_array_offset(unsigned n, const hsize_t *total_size, + const hsize_t *offset); +H5_DLL herr_t H5VM_array_calc(hsize_t offset, unsigned n, + const hsize_t *total_size, hsize_t *coords); +H5_DLL herr_t H5VM_chunk_index(unsigned ndims, const hsize_t *coord, + const uint32_t *chunk, const hsize_t *down_nchunks, hsize_t *chunk_idx); +H5_DLL ssize_t H5VM_opvv(size_t dst_max_nseq, size_t *dst_curr_seq, size_t dst_len_arr[], + hsize_t dst_off_arr[], + size_t src_max_nseq, size_t *src_curr_seq, size_t src_len_arr[], + hsize_t src_off_arr[], + H5VM_opvv_func_t op, void *op_data); +H5_DLL ssize_t H5VM_memcpyvv(void *_dst, + size_t dst_max_nseq, size_t *dst_curr_seq, size_t dst_len_arr[], hsize_t dst_off_arr[], + const void *_src, + size_t src_max_nseq, size_t *src_curr_seq, size_t src_len_arr[], hsize_t src_off_arr[]); + + +/*------------------------------------------------------------------------- + * Function: H5VM_vector_reduce_product + * + * Purpose: Product reduction of a vector. Vector elements and return + * value are size_t because we usually want the number of + * elements in an array and array dimensions are always of type + * size_t. + * + * Return: Success: Product of elements + * + * Failure: 1 if N is zero + * + * Programmer: Robb Matzke + * Friday, October 10, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static H5_inline hsize_t UNUSED +H5VM_vector_reduce_product(unsigned n, const hsize_t *v) +{ + hsize_t ret_value = 1; + + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if (n && !v) HGOTO_DONE(0) + while (n--) ret_value *= *v++; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} + +/*------------------------------------------------------------------------- + * Function: H5VM_vector_zerop_u + * + * Purpose: Determines if all elements of a vector are zero. + * + * Return: Success: TRUE if all elements are zero, + * FALSE otherwise + * + * Failure: TRUE if N is zero + * + * Programmer: Robb Matzke + * Friday, October 10, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static H5_inline htri_t UNUSED +H5VM_vector_zerop_u(int n, const hsize_t *v) +{ + htri_t ret_value=TRUE; /* Return value */ + + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if (!v) + HGOTO_DONE(TRUE) + while (n--) + if (*v++) + HGOTO_DONE(FALSE) + +done: + FUNC_LEAVE_NOAPI(ret_value) +} + +/*------------------------------------------------------------------------- + * Function: H5VM_vector_zerop_s + * + * Purpose: Determines if all elements of a vector are zero. + * + * Return: Success: TRUE if all elements are zero, + * FALSE otherwise + * + * Failure: TRUE if N is zero + * + * Programmer: Robb Matzke + * Friday, October 10, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static H5_inline htri_t UNUSED +H5VM_vector_zerop_s(int n, const hssize_t *v) +{ + htri_t ret_value=TRUE; /* Return value */ + + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if (!v) + HGOTO_DONE(TRUE) + while (n--) + if (*v++) + HGOTO_DONE(FALSE) + +done: + FUNC_LEAVE_NOAPI(ret_value) +} + +/*------------------------------------------------------------------------- + * Function: H5VM_vector_cmp_u + * + * Purpose: Compares two vectors of the same size and determines if V1 is + * lexicographically less than, equal, or greater than V2. + * + * Return: Success: -1 if V1 is less than V2 + * 0 if they are equal + * 1 if V1 is greater than V2 + * + * Failure: 0 if N is zero + * + * Programmer: Robb Matzke + * Friday, October 10, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static H5_inline int UNUSED +H5VM_vector_cmp_u (unsigned n, const hsize_t *v1, const hsize_t *v2) +{ + int ret_value=0; /* Return value */ + + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if (v1 == v2) HGOTO_DONE(0) + if (v1 == NULL) HGOTO_DONE(-1) + if (v2 == NULL) HGOTO_DONE(1) + while (n--) { + if (*v1 < *v2) HGOTO_DONE(-1) + if (*v1 > *v2) HGOTO_DONE(1) + v1++; + v2++; + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} + + +/*------------------------------------------------------------------------- + * Function: H5VM_vector_cmp_s + * + * Purpose: Compares two vectors of the same size and determines if V1 is + * lexicographically less than, equal, or greater than V2. + * + * Return: Success: -1 if V1 is less than V2 + * 0 if they are equal + * 1 if V1 is greater than V2 + * + * Failure: 0 if N is zero + * + * Programmer: Robb Matzke + * Wednesday, April 8, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static H5_inline int UNUSED +H5VM_vector_cmp_s (unsigned n, const hssize_t *v1, const hssize_t *v2) +{ + int ret_value=0; /* Return value */ + + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if (v1 == v2) HGOTO_DONE(0) + if (v1 == NULL) HGOTO_DONE(-1) + if (v2 == NULL) HGOTO_DONE(1) + while (n--) { + if (*v1 < *v2) HGOTO_DONE(-1) + if (*v1 > *v2) HGOTO_DONE(1) + v1++; + v2++; + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} + + +/*------------------------------------------------------------------------- + * Function: H5VM_vector_inc + * + * Purpose: Increments V1 by V2 + * + * Return: void + * + * Programmer: Robb Matzke + * Monday, October 13, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static H5_inline void UNUSED +H5VM_vector_inc(int n, hsize_t *v1, const hsize_t *v2) +{ + while (n--) *v1++ += *v2++; +} + +/* Lookup table for general log2(n) routine */ +static const unsigned char LogTable256[] = +{ + 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 +}; + + +/*------------------------------------------------------------------------- + * Function: H5VM_log2_gen + * + * Purpose: Determines the log base two of a number (i.e. log2(n)). + * (i.e. the highest bit set in a number) + * + * Note: This is from the "Bit Twiddling Hacks" at: + * http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogLookup + * + * The version on the web-site is for 32-bit quantities and this + * version has been extended for 64-bit quantities. + * + * Return: log2(n) (always - no failure condition) + * + * Programmer: Quincey Koziol + * Monday, March 6, 2006 + * + *------------------------------------------------------------------------- + */ +static H5_inline unsigned UNUSED +H5VM_log2_gen(uint64_t n) +{ + unsigned r; /* r will be log2(n) */ + register unsigned int t, tt, ttt; /* temporaries */ + +#ifdef H5_BAD_LOG2_CODE_GENERATED + if(n > (uint64_t)0x7fffffffffffffff) + r = 63; + else { + n &= (uint64_t)0x7fffffffffffffff; +#endif /* H5_BAD_LOG2_CODE_GENERATED */ + if((ttt = (unsigned)(n >> 32))) + if((tt = (unsigned)(n >> 48))) + r = (t = (unsigned)(n >> 56)) ? 56 + (unsigned)LogTable256[t] : 48 + (unsigned)LogTable256[tt & 0xFF]; + else + r = (t = (unsigned)(n >> 40)) ? 40 + (unsigned)LogTable256[t] : 32 + (unsigned)LogTable256[ttt & 0xFF]; + else + if((tt = (unsigned)(n >> 16))) + r = (t = (unsigned)(n >> 24)) ? 24 + (unsigned)LogTable256[t] : 16 + (unsigned)LogTable256[tt & 0xFF]; + else + /* Added 'uint8_t' cast to pacify PGCC compiler */ + r = (t = (unsigned)(n >> 8)) ? 8 + (unsigned)LogTable256[t] : (unsigned)LogTable256[(uint8_t)n]; +#ifdef H5_BAD_LOG2_CODE_GENERATED + } /* end else */ +#endif /* H5_BAD_LOG2_CODE_GENERATED */ + + return(r); +} /* H5VM_log2_gen() */ + + +/* Lookup table for specialized log2(n) of power of two routine */ +static const unsigned MultiplyDeBruijnBitPosition[32] = +{ + 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, + 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9 +}; + + +/*------------------------------------------------------------------------- + * Function: H5VM_log2_of2 + * + * Purpose: Determines the log base two of a number (i.e. log2(n)). + * (i.e. the highest bit set in a number) + * + * Note: **N must be a power of two** and is limited to 32-bit quantities. + * + * This is from the "Bit Twiddling Hacks" at: + * http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogDeBruijn + * + * Return: log2(n) (always - no failure condition) + * + * Programmer: Quincey Koziol + * Monday, Febraury 27, 2006 + * + *------------------------------------------------------------------------- + */ +static H5_inline unsigned UNUSED +H5VM_log2_of2(uint32_t n) +{ +#ifndef NDEBUG + HDassert(POWER_OF_TWO(n)); +#endif /* NDEBUG */ + return(MultiplyDeBruijnBitPosition[(n * (uint32_t)0x077CB531UL) >> 27]); +} /* H5VM_log2_of2() */ + + +/*------------------------------------------------------------------------- + * Function: H5VM_limit_enc_size + * + * Purpose: Determine the # of bytes needed to encode values within a + * range from 0 to a given limit + * + * Return: Number of bytes needed + * + * Programmer: Quincey Koziol + * Thursday, March 13, 2008 + * + *------------------------------------------------------------------------- + */ +static H5_inline unsigned UNUSED +H5VM_limit_enc_size(uint64_t limit) +{ + return (H5VM_log2_gen(limit) / 8) + 1; +} /* end H5VM_limit_enc_size() */ + +static const unsigned char H5VM_bit_set_g[8] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01}; +static const unsigned char H5VM_bit_clear_g[8] = {0x7F, 0xBF, 0xDF, 0xEF, 0xF7, 0xFB, 0xFD, 0xFE}; + + +/*------------------------------------------------------------------------- + * Function: H5VM_bit_get + * + * Purpose: Determine the value of the n'th bit in a buffer. + * + * Note: No range checking on is performed! + * + * Note #2: Bits are sequentially stored in the buffer, starting with bit + * offset 0 in the first byte's high-bit position, proceeding down + * to bit offset 7 in the first byte's low-bit position, then to + * bit offset 8 in the second byte's high-bit position, etc. + * + * Return: TRUE/FALSE + * + * Programmer: Quincey Koziol + * Tuesday, November 25, 2008 + * + *------------------------------------------------------------------------- + */ +static H5_inline hbool_t UNUSED +H5VM_bit_get(const unsigned char *buf, size_t offset) +{ + /* Test the appropriate bit in the buffer */ + return (hbool_t)((buf[offset / 8] & (H5VM_bit_set_g[offset % 8])) ? TRUE : FALSE); +} /* end H5VM_bit_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VM_bit_set + * + * Purpose: Set/reset the n'th bit in a buffer. + * + * Note: No range checking on is performed! + * + * Note #2: Bits are sequentially stored in the buffer, starting with bit + * offset 0 in the first byte's high-bit position, proceeding down + * to bit offset 7 in the first byte's low-bit position, then to + * bit offset 8 in the second byte's high-bit position, etc. + * + * Return: None + * + * Programmer: Quincey Koziol + * Tuesday, November 25, 2008 + * + *------------------------------------------------------------------------- + */ +static H5_inline void UNUSED +H5VM_bit_set(unsigned char *buf, size_t offset, hbool_t val) +{ + /* Set/reset the appropriate bit in the buffer */ + if(val) + buf[offset / 8] |= H5VM_bit_set_g[offset % 8]; + else + buf[offset / 8] &= H5VM_bit_clear_g[offset % 8]; +} /* end H5VM_bit_set() */ + +#endif /* H5VMprivate_H */ + diff --git a/src/H5Vprivate.h b/src/H5Vprivate.h deleted file mode 100644 index 5ce26a0..0000000 --- a/src/H5Vprivate.h +++ /dev/null @@ -1,501 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * Programmer: Robb Matzke - * Friday, October 10, 1997 - */ -#ifndef H5Vprivate_H -#define H5Vprivate_H - -/* Private headers needed by this file */ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ - -/* Vector-Vector sequence operation callback */ -typedef herr_t (*H5V_opvv_func_t)(hsize_t dst_off, hsize_t src_off, - size_t len, void *udata); - -/* Vector comparison functions like Fortran66 comparison operators */ -#define H5V_vector_eq_s(N,V1,V2) (H5V_vector_cmp_s (N, V1, V2)==0) -#define H5V_vector_lt_s(N,V1,V2) (H5V_vector_cmp_s (N, V1, V2)<0) -#define H5V_vector_gt_s(N,V1,V2) (H5V_vector_cmp_s (N, V1, V2)>0) -#define H5V_vector_le_s(N,V1,V2) (H5V_vector_cmp_s (N, V1, V2)<=0) -#define H5V_vector_ge_s(N,V1,V2) (H5V_vector_cmp_s (N, V1, V2)>=0) -#define H5V_vector_eq_u(N,V1,V2) (H5V_vector_cmp_u (N, V1, V2)==0) -#define H5V_vector_lt_u(N,V1,V2) (H5V_vector_cmp_u (N, V1, V2)<0) -#define H5V_vector_gt_u(N,V1,V2) (H5V_vector_cmp_u (N, V1, V2)>0) -#define H5V_vector_le_u(N,V1,V2) (H5V_vector_cmp_u (N, V1, V2)<=0) -#define H5V_vector_ge_u(N,V1,V2) (H5V_vector_cmp_u (N, V1, V2)>=0) - -/* Other functions */ -#define H5V_vector_cpy(N,DST,SRC) { \ - HDassert(sizeof(*(DST))==sizeof(*(SRC))); \ - if (SRC) HDmemcpy (DST, SRC, (N)*sizeof(*(DST))); \ - else HDmemset (DST, 0, (N)*sizeof(*(DST))); \ -} - -#define H5V_vector_zero(N,DST) HDmemset(DST,0,(N)*sizeof(*(DST))) - -/* A null pointer is equivalent to a zero vector */ -#define H5V_ZERO NULL - -H5_DLL hsize_t H5V_hyper_stride(unsigned n, const hsize_t *size, - const hsize_t *total_size, - const hsize_t *offset, - hsize_t *stride); -H5_DLL htri_t H5V_hyper_disjointp(unsigned n, const hsize_t *offset1, - const uint32_t *size1, const hsize_t *offset2, const uint32_t *size2); -H5_DLL htri_t H5V_hyper_eq(unsigned n, const hsize_t *offset1, - const hsize_t *size1, const hsize_t *offset2, - const hsize_t *size2); -H5_DLL herr_t H5V_hyper_fill(unsigned n, const hsize_t *_size, - const hsize_t *total_size, - const hsize_t *offset, void *_dst, - unsigned fill_value); -H5_DLL herr_t H5V_hyper_copy(unsigned n, const hsize_t *size, - const hsize_t *dst_total_size, - const hsize_t *dst_offset, void *_dst, - const hsize_t *src_total_size, - const hsize_t *src_offset, const void *_src); -H5_DLL herr_t H5V_stride_fill(unsigned n, hsize_t elmt_size, const hsize_t *size, - const hsize_t *stride, void *_dst, - unsigned fill_value); -H5_DLL herr_t H5V_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *_size, - const hsize_t *dst_stride, void *_dst, - const hsize_t *src_stride, const void *_src); -H5_DLL herr_t H5V_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *_size, - const hssize_t *dst_stride, void *_dst, - const hssize_t *src_stride, const void *_src); -H5_DLL herr_t H5V_array_fill(void *_dst, const void *src, size_t size, - size_t count); -H5_DLL herr_t H5V_array_down(unsigned n, const hsize_t *total_size, - hsize_t *down); -H5_DLL hsize_t H5V_array_offset_pre(unsigned n, - const hsize_t *acc, const hsize_t *offset); -H5_DLL hsize_t H5V_array_offset(unsigned n, const hsize_t *total_size, - const hsize_t *offset); -H5_DLL herr_t H5V_array_calc(hsize_t offset, unsigned n, - const hsize_t *total_size, hsize_t *coords); -H5_DLL herr_t H5V_chunk_index(unsigned ndims, const hsize_t *coord, - const uint32_t *chunk, const hsize_t *down_nchunks, hsize_t *chunk_idx); -H5_DLL ssize_t H5V_opvv(size_t dst_max_nseq, size_t *dst_curr_seq, size_t dst_len_arr[], - hsize_t dst_off_arr[], - size_t src_max_nseq, size_t *src_curr_seq, size_t src_len_arr[], - hsize_t src_off_arr[], - H5V_opvv_func_t op, void *op_data); -H5_DLL ssize_t H5V_memcpyvv(void *_dst, - size_t dst_max_nseq, size_t *dst_curr_seq, size_t dst_len_arr[], hsize_t dst_off_arr[], - const void *_src, - size_t src_max_nseq, size_t *src_curr_seq, size_t src_len_arr[], hsize_t src_off_arr[]); - - -/*------------------------------------------------------------------------- - * Function: H5V_vector_reduce_product - * - * Purpose: Product reduction of a vector. Vector elements and return - * value are size_t because we usually want the number of - * elements in an array and array dimensions are always of type - * size_t. - * - * Return: Success: Product of elements - * - * Failure: 1 if N is zero - * - * Programmer: Robb Matzke - * Friday, October 10, 1997 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static H5_inline hsize_t UNUSED -H5V_vector_reduce_product(unsigned n, const hsize_t *v) -{ - hsize_t ret_value = 1; - - /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - if (n && !v) HGOTO_DONE(0) - while (n--) ret_value *= *v++; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} - -/*------------------------------------------------------------------------- - * Function: H5V_vector_zerop_u - * - * Purpose: Determines if all elements of a vector are zero. - * - * Return: Success: TRUE if all elements are zero, - * FALSE otherwise - * - * Failure: TRUE if N is zero - * - * Programmer: Robb Matzke - * Friday, October 10, 1997 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static H5_inline htri_t UNUSED -H5V_vector_zerop_u(int n, const hsize_t *v) -{ - htri_t ret_value=TRUE; /* Return value */ - - /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - if (!v) - HGOTO_DONE(TRUE) - while (n--) - if (*v++) - HGOTO_DONE(FALSE) - -done: - FUNC_LEAVE_NOAPI(ret_value) -} - -/*------------------------------------------------------------------------- - * Function: H5V_vector_zerop_s - * - * Purpose: Determines if all elements of a vector are zero. - * - * Return: Success: TRUE if all elements are zero, - * FALSE otherwise - * - * Failure: TRUE if N is zero - * - * Programmer: Robb Matzke - * Friday, October 10, 1997 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static H5_inline htri_t UNUSED -H5V_vector_zerop_s(int n, const hssize_t *v) -{ - htri_t ret_value=TRUE; /* Return value */ - - /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - if (!v) - HGOTO_DONE(TRUE) - while (n--) - if (*v++) - HGOTO_DONE(FALSE) - -done: - FUNC_LEAVE_NOAPI(ret_value) -} - -/*------------------------------------------------------------------------- - * Function: H5V_vector_cmp_u - * - * Purpose: Compares two vectors of the same size and determines if V1 is - * lexicographically less than, equal, or greater than V2. - * - * Return: Success: -1 if V1 is less than V2 - * 0 if they are equal - * 1 if V1 is greater than V2 - * - * Failure: 0 if N is zero - * - * Programmer: Robb Matzke - * Friday, October 10, 1997 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static H5_inline int UNUSED -H5V_vector_cmp_u (unsigned n, const hsize_t *v1, const hsize_t *v2) -{ - int ret_value=0; /* Return value */ - - /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - if (v1 == v2) HGOTO_DONE(0) - if (v1 == NULL) HGOTO_DONE(-1) - if (v2 == NULL) HGOTO_DONE(1) - while (n--) { - if (*v1 < *v2) HGOTO_DONE(-1) - if (*v1 > *v2) HGOTO_DONE(1) - v1++; - v2++; - } - -done: - FUNC_LEAVE_NOAPI(ret_value) -} - - -/*------------------------------------------------------------------------- - * Function: H5V_vector_cmp_s - * - * Purpose: Compares two vectors of the same size and determines if V1 is - * lexicographically less than, equal, or greater than V2. - * - * Return: Success: -1 if V1 is less than V2 - * 0 if they are equal - * 1 if V1 is greater than V2 - * - * Failure: 0 if N is zero - * - * Programmer: Robb Matzke - * Wednesday, April 8, 1998 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static H5_inline int UNUSED -H5V_vector_cmp_s (unsigned n, const hssize_t *v1, const hssize_t *v2) -{ - int ret_value=0; /* Return value */ - - /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - if (v1 == v2) HGOTO_DONE(0) - if (v1 == NULL) HGOTO_DONE(-1) - if (v2 == NULL) HGOTO_DONE(1) - while (n--) { - if (*v1 < *v2) HGOTO_DONE(-1) - if (*v1 > *v2) HGOTO_DONE(1) - v1++; - v2++; - } - -done: - FUNC_LEAVE_NOAPI(ret_value) -} - - -/*------------------------------------------------------------------------- - * Function: H5V_vector_inc - * - * Purpose: Increments V1 by V2 - * - * Return: void - * - * Programmer: Robb Matzke - * Monday, October 13, 1997 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static H5_inline void UNUSED -H5V_vector_inc(int n, hsize_t *v1, const hsize_t *v2) -{ - while (n--) *v1++ += *v2++; -} - -/* Lookup table for general log2(n) routine */ -static const unsigned char LogTable256[] = -{ - 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 -}; - - -/*------------------------------------------------------------------------- - * Function: H5V_log2_gen - * - * Purpose: Determines the log base two of a number (i.e. log2(n)). - * (i.e. the highest bit set in a number) - * - * Note: This is from the "Bit Twiddling Hacks" at: - * http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogLookup - * - * The version on the web-site is for 32-bit quantities and this - * version has been extended for 64-bit quantities. - * - * Return: log2(n) (always - no failure condition) - * - * Programmer: Quincey Koziol - * Monday, March 6, 2006 - * - *------------------------------------------------------------------------- - */ -static H5_inline unsigned UNUSED -H5V_log2_gen(uint64_t n) -{ - unsigned r; /* r will be log2(n) */ - register unsigned int t, tt, ttt; /* temporaries */ - -#ifdef H5_BAD_LOG2_CODE_GENERATED - if(n > (uint64_t)0x7fffffffffffffff) - r = 63; - else { - n &= (uint64_t)0x7fffffffffffffff; -#endif /* H5_BAD_LOG2_CODE_GENERATED */ - if((ttt = (unsigned)(n >> 32))) - if((tt = (unsigned)(n >> 48))) - r = (t = (unsigned)(n >> 56)) ? 56 + (unsigned)LogTable256[t] : 48 + (unsigned)LogTable256[tt & 0xFF]; - else - r = (t = (unsigned)(n >> 40)) ? 40 + (unsigned)LogTable256[t] : 32 + (unsigned)LogTable256[ttt & 0xFF]; - else - if((tt = (unsigned)(n >> 16))) - r = (t = (unsigned)(n >> 24)) ? 24 + (unsigned)LogTable256[t] : 16 + (unsigned)LogTable256[tt & 0xFF]; - else - /* Added 'uint8_t' cast to pacify PGCC compiler */ - r = (t = (unsigned)(n >> 8)) ? 8 + (unsigned)LogTable256[t] : (unsigned)LogTable256[(uint8_t)n]; -#ifdef H5_BAD_LOG2_CODE_GENERATED - } /* end else */ -#endif /* H5_BAD_LOG2_CODE_GENERATED */ - - return(r); -} /* H5V_log2_gen() */ - - -/* Lookup table for specialized log2(n) of power of two routine */ -static const unsigned MultiplyDeBruijnBitPosition[32] = -{ - 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, - 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9 -}; - - -/*------------------------------------------------------------------------- - * Function: H5V_log2_of2 - * - * Purpose: Determines the log base two of a number (i.e. log2(n)). - * (i.e. the highest bit set in a number) - * - * Note: **N must be a power of two** and is limited to 32-bit quantities. - * - * This is from the "Bit Twiddling Hacks" at: - * http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogDeBruijn - * - * Return: log2(n) (always - no failure condition) - * - * Programmer: Quincey Koziol - * Monday, Febraury 27, 2006 - * - *------------------------------------------------------------------------- - */ -static H5_inline unsigned UNUSED -H5V_log2_of2(uint32_t n) -{ -#ifndef NDEBUG - HDassert(POWER_OF_TWO(n)); -#endif /* NDEBUG */ - return(MultiplyDeBruijnBitPosition[(n * (uint32_t)0x077CB531UL) >> 27]); -} /* H5V_log2_of2() */ - - -/*------------------------------------------------------------------------- - * Function: H5V_limit_enc_size - * - * Purpose: Determine the # of bytes needed to encode values within a - * range from 0 to a given limit - * - * Return: Number of bytes needed - * - * Programmer: Quincey Koziol - * Thursday, March 13, 2008 - * - *------------------------------------------------------------------------- - */ -static H5_inline unsigned UNUSED -H5V_limit_enc_size(uint64_t limit) -{ - return (H5V_log2_gen(limit) / 8) + 1; -} /* end H5V_limit_enc_size() */ - -static const unsigned char H5V_bit_set_g[8] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01}; -static const unsigned char H5V_bit_clear_g[8] = {0x7F, 0xBF, 0xDF, 0xEF, 0xF7, 0xFB, 0xFD, 0xFE}; - - -/*------------------------------------------------------------------------- - * Function: H5V_bit_get - * - * Purpose: Determine the value of the n'th bit in a buffer. - * - * Note: No range checking on is performed! - * - * Note #2: Bits are sequentially stored in the buffer, starting with bit - * offset 0 in the first byte's high-bit position, proceeding down - * to bit offset 7 in the first byte's low-bit position, then to - * bit offset 8 in the second byte's high-bit position, etc. - * - * Return: TRUE/FALSE - * - * Programmer: Quincey Koziol - * Tuesday, November 25, 2008 - * - *------------------------------------------------------------------------- - */ -static H5_inline hbool_t UNUSED -H5V_bit_get(const unsigned char *buf, size_t offset) -{ - /* Test the appropriate bit in the buffer */ - return (hbool_t)((buf[offset / 8] & (H5V_bit_set_g[offset % 8])) ? TRUE : FALSE); -} /* end H5V_bit_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5V_bit_set - * - * Purpose: Set/reset the n'th bit in a buffer. - * - * Note: No range checking on is performed! - * - * Note #2: Bits are sequentially stored in the buffer, starting with bit - * offset 0 in the first byte's high-bit position, proceeding down - * to bit offset 7 in the first byte's low-bit position, then to - * bit offset 8 in the second byte's high-bit position, etc. - * - * Return: None - * - * Programmer: Quincey Koziol - * Tuesday, November 25, 2008 - * - *------------------------------------------------------------------------- - */ -static H5_inline void UNUSED -H5V_bit_set(unsigned char *buf, size_t offset, hbool_t val) -{ - /* Set/reset the appropriate bit in the buffer */ - if(val) - buf[offset / 8] |= H5V_bit_set_g[offset % 8]; - else - buf[offset / 8] &= H5V_bit_clear_g[offset % 8]; -} /* end H5V_bit_set() */ - -#endif /* H5Vprivate_H */ - diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index f9e7186..1b8c096 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -20,7 +20,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ -#include "H5Vprivate.h" /* H5V_array_fill */ +#include "H5VMprivate.h" /* H5VM_array_fill */ #include "H5Zpkg.h" /* Data filters */ @@ -292,7 +292,7 @@ static void H5Z_print(H5Z_node *tree, FILE *stream); #define H5Z_XFORM_DO_OP5(TYPE, SIZE) \ { \ TYPE val = ((tree->type == H5Z_XFORM_INTEGER) ? (TYPE)tree->value.int_val : (TYPE)tree->value.float_val); \ - H5V_array_fill(array, &val, sizeof(TYPE), (SIZE)); \ + H5VM_array_fill(array, &val, sizeof(TYPE), (SIZE)); \ } /* The difference of this macro from H5Z_XFORM_DO_OP3 is that it handles the operations when the left operand is empty, like -x or +x. diff --git a/src/Makefile.am b/src/Makefile.am index f63a36e..6525211 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -104,7 +104,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Toh.c \ H5Topaque.c \ H5Torder.c \ - H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c H5V.c H5WB.c H5Z.c \ + H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c H5VM.c H5WB.c H5Z.c \ H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c H5Zszip.c \ H5Zscaleoffset.c H5Ztrans.c diff --git a/src/Makefile.in b/src/Makefile.in index 79b268e..edfa1dd 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -169,7 +169,7 @@ am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \ H5Tfields.lo H5Tfixed.lo H5Tfloat.lo H5Tinit.lo H5Tnative.lo \ H5Toffset.lo H5Toh.lo H5Topaque.lo H5Torder.lo H5Tpad.lo \ H5Tprecis.lo H5Tstrpad.lo H5Tvisit.lo H5Tvlen.lo H5TS.lo \ - H5V.lo H5WB.lo H5Z.lo H5Zdeflate.lo H5Zfletcher32.lo \ + H5VM.lo H5WB.lo H5Z.lo H5Zdeflate.lo H5Zfletcher32.lo \ H5Znbit.lo H5Zshuffle.lo H5Zszip.lo H5Zscaleoffset.lo \ H5Ztrans.lo libhdf5_la_OBJECTS = $(am_libhdf5_la_OBJECTS) @@ -599,7 +599,7 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Toh.c \ H5Topaque.c \ H5Torder.c \ - H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c H5V.c H5WB.c H5Z.c \ + H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c H5VM.c H5WB.c H5Z.c \ H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c H5Zszip.c \ H5Zscaleoffset.c H5Ztrans.c @@ -998,7 +998,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Tvisit.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Tvlen.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5UC.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5V.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5VM.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5WB.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Z.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Zdeflate.Plo@am__quote@ diff --git a/src/hdf5.lnt b/src/hdf5.lnt index 6865720..90af778 100644 --- a/src/hdf5.lnt +++ b/src/hdf5.lnt @@ -1,9 +1,9 @@ // Lint options shared by both PC-Lint for Windows and Flexelint for Linux // Turn off warnings about not using the inlined H5V* functions: --esym(528, H5V_vector_reduce_product, H5V_vector_inc) --esym(528, H5V_vector_cmp, H5V_vector_cmp_s, H5V_vector_cmp_u) --esym(528, H5V_vector_zerop_s, H5V_vector_zerop_u) +-esym(528, H5VM_vector_reduce_product, H5VM_vector_inc) +-esym(528, H5VM_vector_cmp, H5VM_vector_cmp_s, H5VM_vector_cmp_u) +-esym(528, H5VM_vector_zerop_s, H5VM_vector_zerop_u) // Suppress message about using 'goto' in a few functions -efunc(801,H5_term_library,H5_trace) @@ -34,7 +34,7 @@ -esym(534, H5I_clear_type, H5I_dec_type_ref) -esym(534, H5MM_xfree) -esym(534, H5UC_decr) --esym(534, H5V_array_fill) +-esym(534, H5VM_array_fill) // Turn off warnings about "Expression-like macro not parenthesized" for diff --git a/test/earray.c b/test/earray.c index 132913b..2d0a399 100644 --- a/test/earray.c +++ b/test/earray.c @@ -28,7 +28,7 @@ /* Other private headers that this test requires */ #include "H5Iprivate.h" /* IDs */ -#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /* Local macros */ @@ -250,7 +250,7 @@ init_tparam(earray_test_param_t *tparam, const H5EA_create_t *cparam) HDmemset(tparam, 0, sizeof(*tparam)); /* Compute general information */ - tparam->nsblks = 1 + (cparam->max_nelmts_bits - H5V_log2_of2(cparam->data_blk_min_elmts)); + tparam->nsblks = 1 + (cparam->max_nelmts_bits - H5VM_log2_of2(cparam->data_blk_min_elmts)); /* Allocate information for each super block */ tparam->sblk_info = (H5EA_sblk_info_t *)HDmalloc(sizeof(H5EA_sblk_info_t) * tparam->nsblks); @@ -940,7 +940,7 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED *tpara /* Set invalid max. # of elements per data block page bits */ if(test_cparam.idx_blk_elmts > 0) { HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); - test_cparam.max_dblk_page_nelmts_bits = H5V_log2_gen((uint64_t)test_cparam.idx_blk_elmts) - 1; + test_cparam.max_dblk_page_nelmts_bits = H5VM_log2_gen((uint64_t)test_cparam.idx_blk_elmts) - 1; H5E_BEGIN_TRY { ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam, NULL); } H5E_END_TRY; @@ -1743,7 +1743,7 @@ eiter_fw_state(void *_eiter, const H5EA_create_t *cparam, /* Compute super block index for element index */ /* (same eqn. as in H5EA__dblock_sblk_idx()) */ - sblk_idx = H5V_log2_gen((uint64_t)(((idx - cparam->idx_blk_elmts) / cparam->data_blk_min_elmts) + 1)); + sblk_idx = H5VM_log2_gen((uint64_t)(((idx - cparam->idx_blk_elmts) / cparam->data_blk_min_elmts) + 1)); #ifdef QAK HDfprintf(stderr, "idx = %Hu, tparam->sblk_info[%u] = {%Zu, %Zu, %Hu, %Hu}\n", idx, sblk_idx, tparam->sblk_info[sblk_idx].ndblks, tparam->sblk_info[sblk_idx].dblk_nelmts, tparam->sblk_info[sblk_idx].start_idx, tparam->sblk_info[sblk_idx].start_dblk); #endif /* QAK */ @@ -1849,10 +1849,10 @@ eiter_rv_init(const H5EA_create_t *cparam, const earray_test_param_t *tparam, eiter->idx = cnt - 1; eiter->max = cnt - 1; if(cnt > cparam->idx_blk_elmts) { - eiter->max_sblk_idx = H5V_log2_gen((uint64_t)(((eiter->max - cparam->idx_blk_elmts) / cparam->data_blk_min_elmts) + 1)); + eiter->max_sblk_idx = H5VM_log2_gen((uint64_t)(((eiter->max - cparam->idx_blk_elmts) / cparam->data_blk_min_elmts) + 1)); eiter->max_nelmts = EA_NELMTS(cparam, tparam, eiter->max, eiter->max_sblk_idx); eiter->max_ndata_blks = EA_NDATA_BLKS(cparam, tparam, eiter->max, eiter->max_sblk_idx); - eiter->idx_blk_nsblks = 2 * H5V_log2_of2((uint32_t)cparam->sup_blk_min_data_ptrs); + eiter->idx_blk_nsblks = 2 * H5VM_log2_of2((uint32_t)cparam->sup_blk_min_data_ptrs); } /* end if */ else { eiter->max_sblk_idx = (hsize_t)0; @@ -1970,14 +1970,14 @@ eiter_rv_state(void *_eiter, const H5EA_create_t *cparam, hsize_t tmp_idx; /* Temporary index in superblock */ hsize_t dblk_idx; /* Index of data block within superblock */ - idx_sblk_idx = H5V_log2_gen((uint64_t)(((idx - cparam->idx_blk_elmts) / cparam->data_blk_min_elmts) + 1)); + idx_sblk_idx = H5VM_log2_gen((uint64_t)(((idx - cparam->idx_blk_elmts) / cparam->data_blk_min_elmts) + 1)); tmp_idx = idx - (cparam->idx_blk_elmts + tparam->sblk_info[idx_sblk_idx].start_idx); dblk_idx = tmp_idx / tparam->sblk_info[idx_sblk_idx].dblk_nelmts; if(dblk_idx > 0) loc_idx = idx - tparam->sblk_info[idx_sblk_idx].dblk_nelmts; else loc_idx = cparam->idx_blk_elmts + tparam->sblk_info[idx_sblk_idx].start_idx - 1; - loc_sblk_idx = H5V_log2_gen((uint64_t)(((loc_idx - cparam->idx_blk_elmts) / cparam->data_blk_min_elmts) + 1)); + loc_sblk_idx = H5VM_log2_gen((uint64_t)(((loc_idx - cparam->idx_blk_elmts) / cparam->data_blk_min_elmts) + 1)); } /* end else */ #ifdef QAK HDfprintf(stderr, "idx = %Hu, loc_idx = %Hu, eiter->max_sblk_idx = %u, idx_sblk_idx = %u, loc_sblk_idx = %u\n", idx, loc_idx, eiter->max_sblk_idx, idx_sblk_idx, loc_sblk_idx); @@ -2715,7 +2715,7 @@ test_skip_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam, /* Compute super block index for element index */ /* (same eqn. as in H5EA__dblock_sblk_idx()) */ - sblk_idx = H5V_log2_gen((uint64_t)(((idx - cparam->idx_blk_elmts) / cparam->data_blk_min_elmts) + 1)); + sblk_idx = H5VM_log2_gen((uint64_t)(((idx - cparam->idx_blk_elmts) / cparam->data_blk_min_elmts) + 1)); state.nelmts = (hsize_t)cparam->idx_blk_elmts + tparam->sblk_info[sblk_idx].dblk_nelmts; state.ndata_blks = (hsize_t)1; state.nsuper_blks = (hsize_t)1; diff --git a/test/farray.c b/test/farray.c index 2844a5d..7a79aaa 100644 --- a/test/farray.c +++ b/test/farray.c @@ -28,7 +28,7 @@ /* Other private headers that this test requires */ #include "H5Iprivate.h" /* IDs */ -#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /* Local macros */ diff --git a/test/fheap.c b/test/fheap.c index e4aa137..96b0673 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -29,7 +29,7 @@ /* Other private headers that this test requires */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ -#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /* Max. testfile name length */ #define FHEAP_FILENAME_LEN 1024 @@ -1574,7 +1574,7 @@ fill_all_2nd_indirect_rows(H5HF_t *fh, hid_t dxpl, size_t obj_size, width = DTABLE_WIDTH(fh); /* Loop over rows of 2nd level deep indirect blocks */ - for(u = 0; u < (H5V_log2_of2(width) + 1); u++) + for(u = 0; u < (H5VM_log2_of2(width) + 1); u++) if(fill_2nd_indirect_row(fh, dxpl, (u + 1), obj_size, state, keep_ids)) TEST_ERROR @@ -1692,7 +1692,7 @@ fill_all_3rd_indirect_rows(H5HF_t *fh, hid_t dxpl, size_t obj_size, width = DTABLE_WIDTH(fh); /* Loop over rows of 3rd level deep indirect blocks */ - for(u = 0; u < (H5V_log2_of2(width) + 1); u++) + for(u = 0; u < (H5VM_log2_of2(width) + 1); u++) /* Fill row of 3rd level indirect blocks */ if(fill_3rd_indirect_row(fh, dxpl, (u + 1), obj_size, state, keep_ids)) TEST_ERROR @@ -1782,7 +1782,7 @@ fill_all_4th_indirect_rows(H5HF_t *fh, hid_t dxpl, size_t obj_size, width = DTABLE_WIDTH(fh); /* Loop over rows of 4th level deep indirect blocks */ - for(u = 0; u < (H5V_log2_of2(width) + 1); u++) { + for(u = 0; u < (H5VM_log2_of2(width) + 1); u++) { /* Fill row of 4th level indirect blocks */ if(fill_4th_indirect_row(fh, dxpl, (u + 1), obj_size, state, keep_ids)) TEST_ERROR diff --git a/test/freespace.c b/test/freespace.c index c0df4c8..14b0f9a 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -26,7 +26,7 @@ #define H5F_PACKAGE #include "H5Fpkg.h" #include "H5Iprivate.h" -#include "H5Vprivate.h" +#include "H5VMprivate.h" #define FILENAME_LEN 1024 diff --git a/test/hyperslab.c b/test/hyperslab.c index fdeaffd..5e2c109 100644 --- a/test/hyperslab.c +++ b/test/hyperslab.c @@ -25,7 +25,7 @@ #include "h5test.h" #include "H5private.h" #include "H5Eprivate.h" -#include "H5Vprivate.h" +#include "H5VMprivate.h" #define TEST_SMALL 0x0001 #define TEST_MEDIUM 0x0002 @@ -137,7 +137,7 @@ print_ref(size_t nx, size_t ny, size_t nz) /*------------------------------------------------------------------------- * Function: test_fill * - * Purpose: Tests the H5V_hyper_fill() function. + * Purpose: Tests the H5VM_hyper_fill() function. * * Return: Success: SUCCEED * @@ -226,7 +226,7 @@ test_fill(size_t nx, size_t ny, size_t nz, ref_value += fill_value * dx * dy * dz; /* Fill the hyperslab with some value */ - H5V_hyper_fill(ndims, hs_size, dst_size, dst_offset, dst, fill_value); + H5VM_hyper_fill(ndims, hs_size, dst_size, dst_offset, dst, fill_value); /* * Sum the array and compare it to the @@ -285,7 +285,7 @@ error: /*------------------------------------------------------------------------- * Function: test_copy * - * Purpose: Tests H5V_hyper_copy(). + * Purpose: Tests H5VM_hyper_copy(). * * The NX, NY, and NZ arguments are the size for the source and * destination arrays. You may pass zero for NZ or for NY and @@ -466,7 +466,7 @@ test_copy(int mode, * Copy a hyperslab from the global array to the * local array. */ - H5V_hyper_copy(ndims, hs_size, dst_size, dst_offset, dst, src_size, src_offset, src); + H5VM_hyper_copy(ndims, hs_size, dst_size, dst_offset, dst, src_size, src_offset, src); /* * Sum the destination hyperslab. It should be @@ -569,7 +569,7 @@ error: /*------------------------------------------------------------------------- * Function: test_multifill * - * Purpose: Tests the H5V_stride_copy() function by using it to fill a + * Purpose: Tests the H5VM_stride_copy() function by using it to fill a * hyperslab by replicating a multi-byte sequence. This might * be useful to initialize an array of structs with a default * struct value, or to initialize an array of floating-point @@ -634,7 +634,7 @@ test_multifill(size_t nx) * Copy the fill value into each element */ size = nx; - H5V_stride_copy(1, (hsize_t)sizeof(double), &size, &dst_stride, + H5VM_stride_copy(1, (hsize_t)sizeof(double), &size, &dst_stride, &(dst[0].mid), &src_stride, &(fill.mid)); /* @@ -690,7 +690,7 @@ error: /*------------------------------------------------------------------------- * Function: test_endian * - * Purpose: Tests the H5V_stride_copy() function by using it to copy an + * Purpose: Tests the H5VM_stride_copy() function by using it to copy an * array of integers and swap the byte ordering from little * endian to big endian or vice versa depending on the hardware. * @@ -733,7 +733,7 @@ test_endian(size_t nx) size[1] = 4; /* Copy the array */ - H5V_stride_copy_s(2, (hsize_t)1, size, dst_stride, dst + 3, src_stride, src); + H5VM_stride_copy_s(2, (hsize_t)1, size, dst_stride, dst + 3, src_stride, src); /* Compare */ for(i = 0; i < nx; i++) { @@ -824,10 +824,10 @@ test_transpose(size_t nx, size_t ny) /* Copy and transpose */ if(nx == ny) - H5V_stride_copy(2, (hsize_t)sizeof(*src), size, dst_stride, dst, + H5VM_stride_copy(2, (hsize_t)sizeof(*src), size, dst_stride, dst, src_stride, src); else - H5V_stride_copy(2, (hsize_t)sizeof(*src), size, dst_stride, dst, + H5VM_stride_copy(2, (hsize_t)sizeof(*src), size, dst_stride, dst, src_stride, src); /* Check */ @@ -878,7 +878,7 @@ error: /*------------------------------------------------------------------------- * Function: test_sub_super * - * Purpose: Tests H5V_stride_copy() to reduce the resolution of an image + * Purpose: Tests H5VM_stride_copy() to reduce the resolution of an image * by copying half the pixels in the X and Y directions. Then * we use the small image and duplicate every pixel to result in * a 2x2 square. @@ -929,7 +929,7 @@ test_sub_super(size_t nx, size_t ny) dst_stride[1] = 1; /* Copy */ - H5V_stride_copy(2, (hsize_t)sizeof(uint8_t), size, dst_stride, half, + H5VM_stride_copy(2, (hsize_t)sizeof(uint8_t), size, dst_stride, half, src_stride, full); /* Check */ @@ -978,7 +978,7 @@ test_sub_super(size_t nx, size_t ny) dst_stride[3] = sizeof(uint8_t); /* Copy */ - H5V_stride_copy(4, (hsize_t)sizeof(uint8_t), size, dst_stride, twice, + H5VM_stride_copy(4, (hsize_t)sizeof(uint8_t), size, dst_stride, twice, src_stride, half); /* Check */ @@ -1038,7 +1038,7 @@ error: /*------------------------------------------------------------------------- * Function: test_array_fill * - * Purpose: Tests H5V_array_fill routine by copying a multibyte value + * Purpose: Tests H5VM_array_fill routine by copying a multibyte value * (an array of ints, in our case) into all the elements of an * array. * @@ -1072,7 +1072,7 @@ test_array_fill(size_t lo, size_t hi) /* Fill */ for(w = lo; w <= hi; w++) { - H5V_array_fill(dst, src, sizeof(src), w); + H5VM_array_fill(dst, src, sizeof(src), w); /* Check */ for(u = 0; u < w; u++) @@ -1099,7 +1099,7 @@ error: /*------------------------------------------------------------------------- * Function: test_array_offset_n_calc * - * Purpose: Tests H5V_array_offset and H5V_array_calc routines by comparing + * Purpose: Tests H5VM_array_offset and H5VM_array_calc routines by comparing * computed array offsets against calculated ones and then going * back to the coordinates from the offset and checking those. * @@ -1149,14 +1149,14 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z) coords[2] = (hssize_t)(HDrandom() % x); /* Get offset of coordinate */ - off = H5V_array_offset(ARRAY_OFFSET_NDIMS, dims, coords); + off = H5VM_array_offset(ARRAY_OFFSET_NDIMS, dims, coords); /* Check offset of coordinate */ if(a[off] != off) TEST_ERROR /* Get coordinates of offset */ - if(H5V_array_calc(off, ARRAY_OFFSET_NDIMS, dims, new_coords) < 0) + if(H5VM_array_calc(off, ARRAY_OFFSET_NDIMS, dims, new_coords) < 0) TEST_ERROR /* Check computed coordinates */ diff --git a/test/istore.c b/test/istore.c index f99e835..217dfc4 100644 --- a/test/istore.c +++ b/test/istore.c @@ -31,7 +31,7 @@ #include "H5Gprivate.h" #include "H5Oprivate.h" #include "H5Pprivate.h" -#include "H5Vprivate.h" +#include "H5VMprivate.h" const char *FILENAME[] = { "istore", @@ -308,7 +308,7 @@ test_extend(hid_t f, const char *prefix, if((fspace=H5Dget_space(dataset)) < 0) TEST_ERROR; for (ctr = 0; - H5V_vector_lt_u((unsigned)ndims, max_corner, whole_size); + H5VM_vector_lt_u((unsigned)ndims, max_corner, whole_size); ctr++) { /* Size and location */ @@ -388,9 +388,9 @@ test_extend(hid_t f, const char *prefix, if(H5Sclose(mspace) < 0) TEST_ERROR; /* Write to `whole' buffer for later checking */ - H5V_hyper_copy((unsigned)ndims, size, + H5VM_hyper_copy((unsigned)ndims, size, whole_size, offset, whole, /*dst*/ - size, H5V_ZERO, buf); /*src*/ + size, H5VM_ZERO, buf); /*src*/ /* Update max corner */ for (i=0; i<(size_t)ndims; i++) diff --git a/test/mf.c b/test/mf.c index aacf087..93667de 100644 --- a/test/mf.c +++ b/test/mf.c @@ -36,7 +36,7 @@ #include "H5FLprivate.h" #include "H5Iprivate.h" -#include "H5Vprivate.h" +#include "H5VMprivate.h" #define FILENAME_LEN 1024 diff --git a/testpar/t_prop.c b/testpar/t_prop.c index e85b227..f98febb 100644 --- a/testpar/t_prop.c +++ b/testpar/t_prop.c @@ -26,58 +26,53 @@ test_encode_decode(hid_t orig_pl, int mpi_rank, int recv_proc) MPI_Request req[2]; MPI_Status status; hid_t pl; /* Decoded property list */ - void *send_buf = NULL; - size_t send_size = 0; + void *buf = NULL; + size_t buf_size = 0; + int casted_size; herr_t ret; /* Generic return value */ if(mpi_rank == 0) { - /* first call to encode returns only the size of the buffer needed */ - ret = H5Pencode(orig_pl, NULL, &send_size); + ret = H5Pencode(orig_pl, NULL, &buf_size); VRFY((ret >= 0), "H5Pencode succeeded"); - send_buf = (uint8_t *)HDmalloc(send_size); + buf = (uint8_t *)HDmalloc(buf_size); - ret = H5Pencode(orig_pl, send_buf, &send_size); + ret = H5Pencode(orig_pl, buf, &buf_size); VRFY((ret >= 0), "H5Pencode succeeded"); - MPI_Isend(&send_size, 1, MPI_INT, recv_proc, 123, MPI_COMM_WORLD, &req[0]); - MPI_Isend(send_buf, (int)send_size, MPI_BYTE, recv_proc, 124, MPI_COMM_WORLD, &req[1]); - } /* end if */ + /* this is a temp fix to send this size_t */ + casted_size = (int)buf_size; + MPI_Isend(&casted_size, 1, MPI_INT, recv_proc, 123, MPI_COMM_WORLD, &req[0]); + MPI_Isend(buf, casted_size, MPI_BYTE, recv_proc, 124, MPI_COMM_WORLD, &req[1]); + } /* end if */ if(mpi_rank == recv_proc) { - void *recv_buf = NULL; - size_t recv_size = 0; + MPI_Recv(&casted_size, 1, MPI_INT, 0, 123, MPI_COMM_WORLD, &status); + buf_size = casted_size; + buf = (uint8_t *)HDmalloc(buf_size); + MPI_Recv(buf, casted_size, MPI_BYTE, 0, 124, MPI_COMM_WORLD, &status); - MPI_Recv(&recv_size, 1, MPI_INT, 0, 123, MPI_COMM_WORLD, &status); - recv_buf = (uint8_t *)HDmalloc(recv_size); - MPI_Recv(recv_buf, (int)recv_size, MPI_BYTE, 0, 124, MPI_COMM_WORLD, &status); - - pl = H5Pdecode(recv_buf); + pl = H5Pdecode(buf); VRFY((pl >= 0), "H5Pdecode succeeded"); VRFY(H5Pequal(orig_pl, pl), "Property List Equal Succeeded"); ret = H5Pclose(pl); VRFY((ret >= 0), "H5Pclose succeeded"); - - if(NULL != recv_buf) - HDfree(recv_buf); } /* end if */ - if(mpi_rank == 0) { + if(0 == mpi_rank) MPI_Waitall(2, req, MPI_STATUSES_IGNORE); - if(NULL != send_buf) - HDfree(send_buf); - } + + if(NULL != buf) + HDfree(buf); MPI_Barrier(MPI_COMM_WORLD); return(0); } - - void test_plist_ed(void) { -- cgit v0.12