summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-06-10 21:02:48 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-06-10 21:02:48 (GMT)
commitb795b5bf2e0a8dc75956c388d0709db43e3efcf4 (patch)
treeb08f90c0a3e1defd365152437680ce2da9baec76
parentf4492a33c1bc1f794e5887fc76f3dc365d56d181 (diff)
downloadhdf5-b795b5bf2e0a8dc75956c388d0709db43e3efcf4.zip
hdf5-b795b5bf2e0a8dc75956c388d0709db43e3efcf4.tar.gz
hdf5-b795b5bf2e0a8dc75956c388d0709db43e3efcf4.tar.bz2
[svn-r8649] Purpose:
Code optimization Description: Eliminate some operations through temporary variables in H5F_addr_encode. Eliminate some redundant memset()'s of structures that will be completely overwritten in the variable-length datatype code. Platforms tested: Solaris 2.7 (arabica) FreeBSD 4.10 (sleipnir) w/parallel
-rw-r--r--src/H5F.c8
-rw-r--r--src/H5Tvlen.c12
2 files changed, 6 insertions, 14 deletions
diff --git a/src/H5F.c b/src/H5F.c
index 493815b..6b46ddf 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -4200,18 +4200,16 @@ void
H5F_addr_encode(H5F_t *f, uint8_t **pp/*in,out*/, haddr_t addr)
{
unsigned i;
- haddr_t tmp;
assert(f);
assert(pp && *pp);
if (H5F_addr_defined(addr)) {
- tmp = addr;
for (i=0; i<H5F_SIZEOF_ADDR(f); i++) {
- *(*pp)++ = (uint8_t)(tmp & 0xff);
- tmp >>= 8;
+ *(*pp)++ = (uint8_t)(addr & 0xff);
+ addr >>= 8;
}
- assert("overflow" && 0 == tmp);
+ assert("overflow" && 0 == addr);
} else {
for (i=0; i<H5F_SIZEOF_ADDR(f); i++)
diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c
index ee3ec01..739c13c 100644
--- a/src/H5Tvlen.c
+++ b/src/H5Tvlen.c
@@ -805,7 +805,6 @@ H5T_vlen_disk_write(H5F_t *f, hid_t dxpl_id, void *_vl, void *buf, void *_bg, hs
H5HG_t bg_hobjid; /* "Background" VL info sequence's ID info */
/* Get the length of the sequence and heap object ID from background data. */
- HDmemset(&bg_hobjid,0,sizeof(H5HG_t));
UINT32DECODE(bg, bg_seq_len);
/* Get heap information */
@@ -858,7 +857,6 @@ H5T_vlen_disk_setnull(H5F_t *f, hid_t dxpl_id, void *_vl, void *_bg)
uint8_t *vl=(uint8_t *)_vl; /*Pointer to the user's hvl_t information*/
uint8_t *bg=(uint8_t *)_bg; /*Pointer to the old data hvl_t */
uint32_t seq_len=0; /* Sequence length */
- H5HG_t hobjid; /* New VL sequence's heap ID */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5T_vlen_disk_setnull)
@@ -873,7 +871,6 @@ H5T_vlen_disk_setnull(H5F_t *f, hid_t dxpl_id, void *_vl, void *_bg)
H5HG_t bg_hobjid; /* "Background" VL info sequence's ID info */
/* Get the length of the sequence and heap object ID from background data. */
- HDmemset(&bg_hobjid,0,sizeof(H5HG_t));
UINT32DECODE(bg, bg_seq_len);
/* Get heap information */
@@ -891,12 +888,9 @@ H5T_vlen_disk_setnull(H5F_t *f, hid_t dxpl_id, void *_vl, void *_bg)
/* Set the length of the sequence */
UINT32ENCODE(vl, seq_len);
- /* Set the "nil" pointer information for the heap ID */
- HDmemset(&hobjid,0,sizeof(H5HG_t));
-
- /* Encode the heap information */
- H5F_addr_encode(f,&vl,hobjid.addr);
- INT32ENCODE(vl,hobjid.idx);
+ /* Encode the "nil" heap pointer information */
+ H5F_addr_encode(f,&vl,(haddr_t)0);
+ INT32ENCODE(vl,0);
done:
FUNC_LEAVE_NOAPI(ret_value)