diff options
Diffstat (limited to 'src/H5VM.c')
-rw-r--r-- | src/H5VM.c | 204 |
1 files changed, 102 insertions, 102 deletions
@@ -63,7 +63,7 @@ H5VM__stride_optimize1(unsigned *np /*in,out*/, hsize_t *elmt_size /*in,out*/, c /* 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)); + assert(1 == H5VM_vector_reduce_product(0, NULL)); /* Combine adjacent memory accesses */ while (*np && stride1[*np - 1] > 0 && (hsize_t)(stride1[*np - 1]) == *elmt_size) { @@ -102,8 +102,8 @@ H5VM__stride_optimize2(unsigned *np /*in,out*/, hsize_t *elmt_size /*in,out*/, c /* 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); + assert(1 == H5VM_vector_reduce_product(0, NULL)); + assert(*elmt_size > 0); /* Combine adjacent memory accesses */ @@ -228,48 +228,48 @@ H5VM_hyper_stride(unsigned n, const hsize_t *size, const hsize_t *total_size, co FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(n <= H5VM_HYPER_NDIMS); - HDassert(size); - HDassert(total_size); - HDassert(stride); + assert(n <= H5VM_HYPER_NDIMS); + assert(size); + assert(total_size); + assert(stride); /* init */ - HDassert(n > 0); + assert(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]); + assert(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]); + assert(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]); + assert(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]); + assert(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]); + assert(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]); + assert(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); @@ -278,7 +278,7 @@ H5VM_hyper_stride(unsigned n, const hsize_t *size, const hsize_t *total_size, co default: /* others */ for (i = (int)(n - 2), acc = 1; i >= 0; --i) { - HDassert(total_size[i + 1] >= size[i + 1]); + assert(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); @@ -377,14 +377,14 @@ H5VM_hyper_fill(unsigned n, const hsize_t *_size, const hsize_t *total_size, con FUNC_ENTER_NOAPI_NOINIT_NOERR /* check args */ - HDassert(n > 0 && n <= H5VM_HYPER_NDIMS); - HDassert(_size); - HDassert(total_size); - HDassert(dst); + assert(n > 0 && n <= H5VM_HYPER_NDIMS); + assert(_size); + assert(total_size); + assert(dst); #ifndef NDEBUG for (u = 0; u < n; u++) { - HDassert(_size[u] > 0); - HDassert(total_size[u] > 0); + assert(_size[u] > 0); + assert(total_size[u] > 0); } #endif @@ -449,17 +449,17 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size, const hsize_t *dst_size, const 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); + assert(n > 0 && n <= H5VM_HYPER_NDIMS); + assert(_size); + assert(dst_size); + assert(src_size); + assert(dst); + assert(src); #ifndef NDEBUG for (u = 0; u < n; u++) { - HDassert(_size[u] > 0); - HDassert(dst_size[u] > 0); - HDassert(src_size[u] > 0); + assert(_size[u] > 0); + assert(dst_size[u] > 0); + assert(src_size[u] > 0); } #endif @@ -478,7 +478,7 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size, const hsize_t *dst_size, const int ii; /*counter */ /* init */ - HDassert(n > 0); + assert(n > 0); dst_stride[n - 1] = 1; src_stride[n - 1] = 1; dst_start = dst_offset ? dst_offset[n - 1] : 0; @@ -487,8 +487,8 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size, const hsize_t *dst_size, const /* Unroll loop for common cases */ switch (n) { case 2: - HDassert(dst_size[1] >= size[1]); - HDassert(src_size[1] >= size[1]); + assert(dst_size[1] >= size[1]); + assert(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]; @@ -498,8 +498,8 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size, const hsize_t *dst_size, const break; case 3: - HDassert(dst_size[2] >= size[2]); - HDassert(src_size[2] >= size[2]); + assert(dst_size[2] >= size[2]); + assert(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]; @@ -507,8 +507,8 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size, const hsize_t *dst_size, const 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]); + assert(dst_size[1] >= size[1]); + assert(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]; @@ -518,8 +518,8 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size, const hsize_t *dst_size, const break; case 4: - HDassert(dst_size[3] >= size[3]); - HDassert(src_size[3] >= size[3]); + assert(dst_size[3] >= size[3]); + assert(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]; @@ -527,8 +527,8 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size, const hsize_t *dst_size, const 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]); + assert(dst_size[2] >= size[2]); + assert(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]; @@ -536,8 +536,8 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size, const hsize_t *dst_size, const 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]); + assert(dst_size[1] >= size[1]); + assert(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]; @@ -549,8 +549,8 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size, const hsize_t *dst_size, const 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]); + assert(dst_size[ii + 1] >= size[ii + 1]); + assert(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]; @@ -599,14 +599,14 @@ H5VM_stride_fill(unsigned n, hsize_t elmt_size, const hsize_t *size, const hsize FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(elmt_size < SIZE_MAX); + assert(elmt_size < SIZE_MAX); H5VM_vector_cpy(n, idx, size); nelmts = H5VM_vector_reduce_product(n, size); for (i = 0; i < nelmts; i++) { /* Copy an element */ H5_CHECK_OVERFLOW(elmt_size, hsize_t, size_t); - HDmemset(dst, (int)fill_value, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */ + memset(dst, (int)fill_value, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */ /* Decrement indices and advance pointer */ for (j = (int)(n - 1), carry = TRUE; j >= 0 && carry; --j) { @@ -615,7 +615,7 @@ H5VM_stride_fill(unsigned n, hsize_t elmt_size, const hsize_t *size, const hsize if (--idx[j]) carry = FALSE; else { - HDassert(size); + assert(size); idx[j] = size[j]; } /* end else */ } @@ -657,7 +657,7 @@ H5VM_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size, const hsize FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(elmt_size < SIZE_MAX); + assert(elmt_size < SIZE_MAX); if (n) { H5VM_vector_cpy(n, idx, size); @@ -676,7 +676,7 @@ H5VM_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size, const hsize if (--idx[j]) carry = FALSE; else { - HDassert(size); + assert(size); idx[j] = size[j]; } } @@ -723,7 +723,7 @@ H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size, const hss FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(elmt_size < SIZE_MAX); + assert(elmt_size < SIZE_MAX); if (n) { H5VM_vector_cpy(n, idx, size); @@ -742,7 +742,7 @@ H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size, const hss if (--idx[j]) carry = FALSE; else { - HDassert(size); + assert(size); idx[j] = size[j]; } } @@ -780,10 +780,10 @@ H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count) FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(dst); - HDassert(src); - HDassert(size < SIZE_MAX && size > 0); - HDassert(count < SIZE_MAX && count > 0); + assert(dst); + assert(src); + assert(size < SIZE_MAX && size > 0); + assert(count < SIZE_MAX && count > 0); H5MM_memcpy(dst, src, size); /* copy first item */ @@ -831,9 +831,9 @@ H5VM_array_down(unsigned n, const hsize_t *total_size, hsize_t *down) FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(n <= H5VM_HYPER_NDIMS); - HDassert(total_size); - HDassert(down); + assert(n <= H5VM_HYPER_NDIMS); + assert(total_size); + assert(down); /* Build the sizes of each dimension in the array * (From fastest to slowest) @@ -871,9 +871,9 @@ H5VM_array_offset_pre(unsigned n, const hsize_t *acc, const hsize_t *offset) FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(n <= H5VM_HYPER_NDIMS); - HDassert(acc); - HDassert(offset); + assert(n <= H5VM_HYPER_NDIMS); + assert(acc); + assert(offset); /* Compute offset in array */ for (u = 0, ret_value = 0; u < n; u++) @@ -907,9 +907,9 @@ H5VM_array_offset(unsigned n, const hsize_t *total_size, const hsize_t *offset) FUNC_ENTER_NOAPI_NOERR - HDassert(n <= H5VM_HYPER_NDIMS); - HDassert(total_size); - HDassert(offset); + assert(n <= H5VM_HYPER_NDIMS); + assert(total_size); + assert(offset); /* Build the sizes of each dimension in the array */ H5VM_array_down(n, total_size, acc_arr); @@ -946,8 +946,8 @@ H5VM_array_calc_pre(hsize_t offset, unsigned n, const hsize_t *down, hsize_t *co FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(n <= H5VM_HYPER_NDIMS); - HDassert(coords); + assert(n <= H5VM_HYPER_NDIMS); + assert(coords); /* Compute the coordinates from the offset */ for (u = 0; u < n; u++) { @@ -985,9 +985,9 @@ H5VM_array_calc(hsize_t offset, unsigned n, const hsize_t *total_size, hsize_t * FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(n <= H5VM_HYPER_NDIMS); - HDassert(total_size); - HDassert(coords); + assert(n <= H5VM_HYPER_NDIMS); + assert(total_size); + assert(coords); /* Build the sizes of each dimension in the array */ H5VM_array_down(n, total_size, idx); @@ -1049,10 +1049,10 @@ H5VM_chunk_index(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, co FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(ndims <= H5VM_HYPER_NDIMS); - HDassert(coord); - HDassert(chunk); - HDassert(down_nchunks); + assert(ndims <= H5VM_HYPER_NDIMS); + assert(coord); + assert(chunk); + assert(down_nchunks); /* Defer to H5VM_chunk_index_scaled */ chunk_idx = H5VM_chunk_index_scaled(ndims, coord, chunk, down_nchunks, scaled_coord); @@ -1080,10 +1080,10 @@ H5VM_chunk_scaled(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, h FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(ndims <= H5VM_HYPER_NDIMS); - HDassert(coord); - HDassert(chunk); - HDassert(scaled); + assert(ndims <= H5VM_HYPER_NDIMS); + assert(coord); + assert(chunk); + assert(scaled); /* Compute the scaled coordinates for actual coordinates */ /* (Note that the 'scaled' array is an 'OUT' parameter) */ @@ -1146,11 +1146,11 @@ H5VM_chunk_index_scaled(unsigned ndims, const hsize_t *coord, const uint32_t *ch FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(ndims <= H5VM_HYPER_NDIMS); - HDassert(coord); - HDassert(chunk); - HDassert(down_nchunks); - HDassert(scaled); + assert(ndims <= H5VM_HYPER_NDIMS); + assert(coord); + assert(chunk); + assert(down_nchunks); + assert(scaled); /* Compute the scaled coordinates for actual coordinates */ /* (Note that the 'scaled' array is an 'OUT' parameter) */ @@ -1202,15 +1202,15 @@ H5VM_opvv(size_t dst_max_nseq, size_t *dst_curr_seq, size_t dst_len_arr[], hsize FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(dst_curr_seq); - HDassert(*dst_curr_seq < dst_max_nseq); - HDassert(dst_len_arr); - HDassert(dst_off_arr); - HDassert(src_curr_seq); - HDassert(*src_curr_seq < src_max_nseq); - HDassert(src_len_arr); - HDassert(src_off_arr); - HDassert(op); + assert(dst_curr_seq); + assert(*dst_curr_seq < dst_max_nseq); + assert(dst_len_arr); + assert(dst_off_arr); + assert(src_curr_seq); + assert(*src_curr_seq < src_max_nseq); + assert(src_len_arr); + assert(src_off_arr); + assert(op); /* Set initial offset & length pointers */ dst_len_ptr = dst_len_arr + *dst_curr_seq; @@ -1408,16 +1408,16 @@ H5VM_memcpyvv(void *_dst, size_t dst_max_nseq, size_t *dst_curr_seq, size_t dst_ 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); + assert(_dst); + assert(dst_curr_seq); + assert(*dst_curr_seq < dst_max_nseq); + assert(dst_len_arr); + assert(dst_off_arr); + assert(_src); + assert(src_curr_seq); + assert(*src_curr_seq < src_max_nseq); + assert(src_len_arr); + assert(src_off_arr); /* Set initial offset & length pointers */ dst_len_ptr = dst_len_arr + *dst_curr_seq; |