diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2016-06-06 00:45:37 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2016-06-06 00:45:37 (GMT) |
commit | dd6c8994c01cd31b5230e98838f11e4c229fdb34 (patch) | |
tree | 3b30f5bc0090c7d25ab67248422891a6a0e19a8d /src/H5Tbit.c | |
parent | 60aebe36b64de110a2a73bc66726e77fba299711 (diff) | |
download | hdf5-dd6c8994c01cd31b5230e98838f11e4c229fdb34.zip hdf5-dd6c8994c01cd31b5230e98838f11e4c229fdb34.tar.gz hdf5-dd6c8994c01cd31b5230e98838f11e4c229fdb34.tar.bz2 |
[svn-r30017] Description:
Bring warning cleanusp in r29990, 29993, 29997, 29999, 30004 from
revise_chunks branch to trunk.
Tested on:
MacOSX/64 10.11.5 (amazon) w/serial, parallel & production.
(h5committest forthcoming)
Diffstat (limited to 'src/H5Tbit.c')
-rw-r--r-- | src/H5Tbit.c | 67 |
1 files changed, 31 insertions, 36 deletions
diff --git a/src/H5Tbit.c b/src/H5Tbit.c index 8c53066..a6b917f 100644 --- a/src/H5Tbit.c +++ b/src/H5Tbit.c @@ -514,22 +514,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5T__bit_inc + * Function: H5T__bit_inc * - * Purpose: Increment part of a bit field by adding 1. The bit field + * Purpose: Increment part of a bit field by adding 1. The bit field * starts with bit position START and is SIZE bits long. * - * Return: Success: The carry-out value. One if overflows, - * zero otherwise. - * - * Failure: Negative + * Return: The carry-out value. TRUE if overflows, FALSE otherwise. * * Programmer: Robb Matzke * Friday, June 26, 1998 * *------------------------------------------------------------------------- */ -htri_t +hbool_t H5T__bit_inc(uint8_t *buf, size_t start, size_t size) { size_t idx = start / 8; @@ -545,38 +542,38 @@ H5T__bit_inc(uint8_t *buf, size_t start, size_t size) /* The first partial byte */ if(start) { - if(size + start < 8) + if(size + start < 8) mask = ((unsigned)1 << size) - 1; - else + else mask = ((unsigned)1 << (8 - start)) - 1; - acc = ((unsigned)buf[idx] >> start) & mask; - acc++; - carry = acc & ((unsigned)1 << MIN(size, 8 - start)); - buf[idx] &= (uint8_t)(~(mask << start)); - buf[idx] = (uint8_t)(buf[idx] | ((acc & mask) << start)); - size -= MIN(size, 8 - start); - start = 0; - idx++; + acc = ((unsigned)buf[idx] >> start) & mask; + acc++; + carry = acc & ((unsigned)1 << MIN(size, 8 - start)); + buf[idx] &= (uint8_t)(~(mask << start)); + buf[idx] = (uint8_t)(buf[idx] | ((acc & mask) << start)); + size -= MIN(size, 8 - start); + start = 0; + idx++; } /* end if */ /* The middle */ while(carry && size >= 8) { - acc = buf[idx]; - acc++; - carry = acc & 0x100; - buf[idx] = acc & 0xff; - idx++; - size -= 8; + acc = buf[idx]; + acc++; + carry = acc & 0x100; + buf[idx] = acc & 0xff; + idx++; + size -= 8; } /* end while */ /* The last bits */ if(carry && size > 0) { - mask = ((unsigned)1 << size) - 1; - acc = buf[idx] & mask; - acc++; - carry = acc & ((unsigned)1 << size); - buf[idx] &= (uint8_t)(~mask); - buf[idx] |= (uint8_t)(acc & mask); + mask = ((unsigned)1 << size) - 1; + acc = buf[idx] & mask; + acc++; + carry = acc & ((unsigned)1 << size); + buf[idx] &= (uint8_t)(~mask); + buf[idx] |= (uint8_t)(acc & mask); } /* end if */ FUNC_LEAVE_NOAPI(carry ? TRUE : FALSE) @@ -586,20 +583,18 @@ H5T__bit_inc(uint8_t *buf, size_t start, size_t size) /*------------------------------------------------------------------------- * Function: H5T__bit_dec * - * Purpose: decrement part of a bit field by substracting 1. The bit + * Purpose: Decrement part of a bit field by substracting 1. The bit * field starts with bit position START and is SIZE bits long. * - * Return: Success: The "borrow-in" value. It's one if underflows, - * zero otherwise. + * Return: The "borrow-in" value. It's TRUE if underflows, FALSE + * otherwise. * - * Failure: Negative - * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * March 17, 2004 * *------------------------------------------------------------------------- */ -htri_t +hbool_t H5T__bit_dec(uint8_t *buf, size_t start, size_t size) { size_t idx = start / 8; |