summaryrefslogtreecommitdiffstats
path: root/src/H5V.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-09-23 20:43:22 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-09-23 20:43:22 (GMT)
commit82c6eab1814e1e06ef9472f6f4bbc8522064e0bc (patch)
tree8b2cd87ac76865c95e4f58ed4f45766a12d8d738 /src/H5V.c
parent6ff8aac3a760ea8b69b5fad866b1d06cc41c6b14 (diff)
downloadhdf5-82c6eab1814e1e06ef9472f6f4bbc8522064e0bc.zip
hdf5-82c6eab1814e1e06ef9472f6f4bbc8522064e0bc.tar.gz
hdf5-82c6eab1814e1e06ef9472f6f4bbc8522064e0bc.tar.bz2
[svn-r19476] Description:
Polish the vectorized memory <-> memory and memory <-> file I/O routines to speed them up a little bit (~10%) Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, w/threadsafe, in production mode Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode Mac OS X/32 10.6.4 (amazon) in debug mode Mac OS X/32 10.6.4 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode Mac OS X/32 10.6.4 (amazon) w/parallel, in debug mode
Diffstat (limited to 'src/H5V.c')
-rw-r--r--src/H5V.c62
1 files changed, 29 insertions, 33 deletions
diff --git a/src/H5V.c b/src/H5V.c
index 48fa9ab..979b591 100644
--- a/src/H5V.c
+++ b/src/H5V.c
@@ -1304,8 +1304,6 @@ H5V_chunk_index(unsigned ndims, const hsize_t *coord, const uint32_t *chunk,
* Programmer: Quincey Koziol
* Friday, May 2, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
ssize_t
@@ -1316,64 +1314,62 @@ H5V_memcpyvv(void *_dst,
{
unsigned char *dst; /* Destination buffer pointer */
const unsigned char *src; /* Source buffer pointer */
- size_t total_size=0; /* Total size of sequence in bytes */
size_t size; /* Size of sequence in bytes */
size_t u,v; /* Local index variables */
- ssize_t ret_value; /* Return value */
+ ssize_t ret_value = 0; /* Return value (Total size of sequence in bytes) */
FUNC_ENTER_NOAPI_NOFUNC(H5V_memcpyvv)
/* Sanity check */
- 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);
+ 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);
/* Work through all the sequences */
- for(u=*dst_curr_seq, v=*src_curr_seq; u<dst_max_nseq && v<src_max_nseq; ) {
+ for(u = *dst_curr_seq, v = *src_curr_seq; u < dst_max_nseq && v < src_max_nseq; ) {
/* Choose smallest buffer to write */
- if(src_len_arr[v]<dst_len_arr[u])
- size=src_len_arr[v];
+ if(src_len_arr[v] < dst_len_arr[u])
+ size = src_len_arr[v];
else
- size=dst_len_arr[u];
+ size = dst_len_arr[u];
/* Compute offset on disk */
- dst=(unsigned char *)_dst+dst_off_arr[u];
+ dst = (unsigned char *)_dst + dst_off_arr[u];
/* Compute offset in memory */
- src=(const unsigned char *)_src+src_off_arr[v];
+ src = (const unsigned char *)_src + src_off_arr[v];
/* Copy data */
- HDmemcpy(dst,src,size);
+ HDmemcpy(dst, src, size);
/* Update source information */
- src_len_arr[v]-=size;
- src_off_arr[v]+=size;
- if(src_len_arr[v]==0)
+ src_len_arr[v] -= size;
+ if(0 == src_len_arr[v])
v++;
+ else
+ src_off_arr[v] += size;
/* Update destination information */
- dst_len_arr[u]-=size;
- dst_off_arr[u]+=size;
- if(dst_len_arr[u]==0)
+ dst_len_arr[u] -= size;
+ if(0 == dst_len_arr[u])
u++;
+ else
+ dst_off_arr[u] += size;
/* Increment number of bytes copied */
- total_size+=size;
+ ret_value += (ssize_t)size;
} /* end for */
/* Update current sequence vectors */
- *dst_curr_seq=u;
- *src_curr_seq=v;
-
- /* Set return value */
- H5_ASSIGN_OVERFLOW(ret_value,total_size,size_t,ssize_t);
+ *dst_curr_seq = u;
+ *src_curr_seq = v;
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5V_memcpyvv() */