diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2002-05-28 18:17:12 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2002-05-28 18:17:12 (GMT) |
commit | ca912c389e4e641cfbae6facced950ad05578d65 (patch) | |
tree | 6bd8604f6a587ee07013ad40daa3c0c7f4b31c26 /src/H5Tbit.c | |
parent | 893cf5899c2b724aa438b66a275967b1f5ad0342 (diff) | |
download | hdf5-ca912c389e4e641cfbae6facced950ad05578d65.zip hdf5-ca912c389e4e641cfbae6facced950ad05578d65.tar.gz hdf5-ca912c389e4e641cfbae6facced950ad05578d65.tar.bz2 |
[svn-r5467] Purpose:
Code cleanup.
Description:
Took Robb's recent ideas for improving the FUNC_ENTER/FUNC_LEAVE macros
equivalents in the SAF library and adapted them to our library. I added
an additional macro which is equivalent to FUNC_ENTER:
FUNC_ENTER_NOINIT - Has the API tracing code, etc. from FUNC_ENTER but
none of the library or interface initialization code. This is to
be used _only_ for static functions and those which explicitly
cannot have the library or interface initialization code enabled
(like the API termination routines, etc.).
This allowed many more of the functions in the library [but not all yet :-(]
to be wrapped with FUNC_ENTER[_NOINIT]/FUNC_LEAVE pairs.
It also reduced the size of the library and executables (by cutting out a
bunch of code which was never executed), I'll e-mail the exact results when
I've finished editing it.
Platforms tested:
IRIX64 6.5 (modi4)
Diffstat (limited to 'src/H5Tbit.c')
-rw-r--r-- | src/H5Tbit.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/H5Tbit.c b/src/H5Tbit.c index b868fa5..a89e2e8 100644 --- a/src/H5Tbit.c +++ b/src/H5Tbit.c @@ -317,10 +317,12 @@ H5T_bit_find (uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, ssize_t idx, i; size_t iu; + /* Use FUNC_ENTER_NOINIT here to avoid performance issues */ + FUNC_ENTER_NOINIT(H5T_bit_find); + /* Some functions call this with value=TRUE */ assert (TRUE==1); - switch (direction) { case H5T_BIT_LSB: /* Calculate index */ @@ -331,7 +333,7 @@ H5T_bit_find (uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, if (offset) { for (iu=offset; iu<8 && size>0; iu++, size--) { if (value==(hbool_t)((buf[idx]>>iu) & 0x01)) { - return 8*idx+(ssize_t)iu - base; + HRETURN(8*idx+(ssize_t)iu - base); } } offset = 0; @@ -342,7 +344,7 @@ H5T_bit_find (uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, if ((value?0x00:0xff)!=buf[idx]) { for (i=0; i<8; i++) { if (value==(hbool_t)((buf[idx]>>i) & 0x01)) { - return 8*idx+i - base; + HRETURN(8*idx+i - base); } } } @@ -352,7 +354,7 @@ H5T_bit_find (uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, /* End */ for (i=0; i<(ssize_t)size; i++) { if (value==(hbool_t)((buf[idx]>>i) & 0x01)) { - return 8*idx+i - base; + HRETURN(8*idx+i - base); } } break; @@ -366,7 +368,7 @@ H5T_bit_find (uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, if (size>8-offset && (offset+size)%8) { for (iu=(offset+size)%8; iu>0; --iu, --size) { if (value==(hbool_t)((buf[idx]>>(iu-1)) & 0x01)) { - return 8*idx+(ssize_t)(iu-1) - base; + HRETURN(8*idx+(ssize_t)(iu-1) - base); } } --idx; @@ -376,7 +378,7 @@ H5T_bit_find (uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, if ((value?0x00:0xff)!=buf[idx]) { for (i=7; i>=0; --i) { if (value==(hbool_t)((buf[idx]>>i) & 0x01)) { - return 8*idx+i - base; + HRETURN(8*idx+i - base); } } } @@ -387,7 +389,7 @@ H5T_bit_find (uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, if (size>0) { for (iu=offset+size; iu>offset; --iu) { if (value==(hbool_t)((buf[idx]>>(iu-1)) & 0x01)) { - return 8*idx+(ssize_t)(iu-1) - base; + HRETURN(8*idx+(ssize_t)(iu-1) - base); } } } @@ -395,7 +397,7 @@ H5T_bit_find (uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, } - return -1; + FUNC_LEAVE(-1); } @@ -423,6 +425,9 @@ H5T_bit_inc(uint8_t *buf, size_t start, size_t size) unsigned carry = 1; unsigned acc, mask; + /* Use FUNC_ENTER_NOINIT here to avoid performance issues */ + FUNC_ENTER_NOINIT(H5T_bit_find); + assert(buf); start %= 8; @@ -460,5 +465,5 @@ H5T_bit_inc(uint8_t *buf, size_t start, size_t size) buf[idx] |= acc & mask; } - return carry ? TRUE : FALSE; + FUNC_LEAVE(carry ? TRUE : FALSE); } |