summaryrefslogtreecommitdiffstats
path: root/src/H5VMprivate.h
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2021-04-07 19:26:09 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2021-04-07 19:26:09 (GMT)
commit1a75bc504f09d5926b1996fb96ddc9d620a7216e (patch)
treeca66d1064b015b55b298e6b20cb9b9d5c41e00ab /src/H5VMprivate.h
parent85cbe79836c9b9efd050c8ad0db4db5b40fec6d6 (diff)
downloadhdf5-1a75bc504f09d5926b1996fb96ddc9d620a7216e.zip
hdf5-1a75bc504f09d5926b1996fb96ddc9d620a7216e.tar.gz
hdf5-1a75bc504f09d5926b1996fb96ddc9d620a7216e.tar.bz2
Brings inline changes from develop
Diffstat (limited to 'src/H5VMprivate.h')
-rw-r--r--src/H5VMprivate.h129
1 files changed, 84 insertions, 45 deletions
diff --git a/src/H5VMprivate.h b/src/H5VMprivate.h
index b7e32a3..2fea2fc 100644
--- a/src/H5VMprivate.h
+++ b/src/H5VMprivate.h
@@ -19,9 +19,9 @@
#define H5VMprivate_H
/* Private headers needed by this file */
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5MMprivate.h" /* Memory management */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
/* Vector-Vector sequence operation callback */
typedef herr_t (*H5VM_opvv_func_t)(hsize_t dst_off, hsize_t src_off, size_t len, void *udata);
@@ -130,6 +130,10 @@ H5_DLL ssize_t H5VM_memcpyvv(void *_dst, size_t dst_max_nseq, size_t *dst_curr_s
* elements in an array and array dimensions are always of type
* size_t.
*
+ * Note: Although this routine is 'static' in this file, that's intended
+ * only as an optimization and the naming (with a single underscore)
+ * reflects its inclusion in a "private" header file.
+ *
* Return: Success: Product of elements
*
* Failure: 1 if N is zero
@@ -137,11 +141,9 @@ H5_DLL ssize_t H5VM_memcpyvv(void *_dst, size_t dst_max_nseq, size_t *dst_curr_s
* Programmer: Robb Matzke
* Friday, October 10, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-static H5_INLINE hsize_t H5_ATTR_UNUSED
+static inline hsize_t H5_ATTR_UNUSED
H5VM_vector_reduce_product(unsigned n, const hsize_t *v)
{
hsize_t ret_value = 1;
@@ -163,6 +165,10 @@ done:
*
* Purpose: Determines if all elements of a vector are zero.
*
+ * Note: Although this routine is 'static' in this file, that's intended
+ * only as an optimization and the naming (with a single underscore)
+ * reflects its inclusion in a "private" header file.
+ *
* Return: Success: TRUE if all elements are zero,
* FALSE otherwise
*
@@ -171,11 +177,9 @@ done:
* Programmer: Robb Matzke
* Friday, October 10, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-static H5_INLINE htri_t H5_ATTR_UNUSED
+static inline htri_t H5_ATTR_UNUSED
H5VM_vector_zerop_u(int n, const hsize_t *v)
{
htri_t ret_value = TRUE; /* Return value */
@@ -198,6 +202,10 @@ done:
*
* Purpose: Determines if all elements of a vector are zero.
*
+ * Note: Although this routine is 'static' in this file, that's intended
+ * only as an optimization and the naming (with a single underscore)
+ * reflects its inclusion in a "private" header file.
+ *
* Return: Success: TRUE if all elements are zero,
* FALSE otherwise
*
@@ -206,11 +214,9 @@ done:
* Programmer: Robb Matzke
* Friday, October 10, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-static H5_INLINE htri_t H5_ATTR_UNUSED
+static inline htri_t H5_ATTR_UNUSED
H5VM_vector_zerop_s(int n, const hssize_t *v)
{
htri_t ret_value = TRUE; /* Return value */
@@ -234,6 +240,10 @@ done:
* Purpose: Compares two vectors of the same size and determines if V1 is
* lexicographically less than, equal, or greater than V2.
*
+ * Note: Although this routine is 'static' in this file, that's intended
+ * only as an optimization and the naming (with a single underscore)
+ * reflects its inclusion in a "private" header file.
+ *
* Return: Success: -1 if V1 is less than V2
* 0 if they are equal
* 1 if V1 is greater than V2
@@ -243,11 +253,9 @@ done:
* Programmer: Robb Matzke
* Friday, October 10, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-static H5_INLINE int H5_ATTR_UNUSED
+static inline int H5_ATTR_UNUSED
H5VM_vector_cmp_u(unsigned n, const hsize_t *v1, const hsize_t *v2)
{
int ret_value = 0; /* Return value */
@@ -275,25 +283,27 @@ done:
}
/*-------------------------------------------------------------------------
- * Function: H5VM_vector_cmp_s
+ * Function: H5VM_vector_cmp_s
*
* Purpose: Compares two vectors of the same size and determines if V1 is
* lexicographically less than, equal, or greater than V2.
*
+ * Note: Although this routine is 'static' in this file, that's intended
+ * only as an optimization and the naming (with a single underscore)
+ * reflects its inclusion in a "private" header file.
+ *
* Return: Success: -1 if V1 is less than V2
* 0 if they are equal
* 1 if V1 is greater than V2
*
* Failure: 0 if N is zero
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Wednesday, April 8, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-static H5_INLINE int H5_ATTR_UNUSED
+static inline int H5_ATTR_UNUSED
H5VM_vector_cmp_s(unsigned n, const hssize_t *v1, const hssize_t *v2)
{
int ret_value = 0; /* Return value */
@@ -325,16 +335,18 @@ done:
*
* Purpose: Increments V1 by V2
*
+ * Note: Although this routine is 'static' in this file, that's intended
+ * only as an optimization and the naming (with a single underscore)
+ * reflects its inclusion in a "private" header file.
+ *
* Return: void
*
* Programmer: Robb Matzke
* Monday, October 13, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-static H5_INLINE void H5_ATTR_UNUSED
+static inline void H5_ATTR_UNUSED
H5VM_vector_inc(int n, hsize_t *v1, const hsize_t *v2)
{
while (n--)
@@ -343,14 +355,17 @@ H5VM_vector_inc(int n, hsize_t *v1, const hsize_t *v2)
/* Lookup table for general log2(n) routine */
static const unsigned char LogTable256[] = {
- 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
-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, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
+ /* clang-clang-format on */
+};
/*-------------------------------------------------------------------------
* Function: H5VM_log2_gen
@@ -364,6 +379,10 @@ static const unsigned char LogTable256[] = {
* The version on the web-site is for 32-bit quantities and this
* version has been extended for 64-bit quantities.
*
+ * Note: Although this routine is 'static' in this file, that's intended
+ * only as an optimization and the naming (with a single underscore)
+ * reflects its inclusion in a "private" header file.
+ *
* Return: log2(n) (always - no failure condition)
*
* Programmer: Quincey Koziol
@@ -371,7 +390,7 @@ static const unsigned char LogTable256[] = {
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE unsigned H5_ATTR_UNUSED
+static inline unsigned H5_ATTR_UNUSED
H5VM_log2_gen(uint64_t n)
{
unsigned r; /* r will be log2(n) */
@@ -409,6 +428,10 @@ static const unsigned MultiplyDeBruijnBitPosition[32] = {0, 1, 28, 2, 29, 14,
* This is from the "Bit Twiddling Hacks" at:
* http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogDeBruijn
*
+ * Note: Although this routine is 'static' in this file, that's intended
+ * only as an optimization and the naming (with a single underscore)
+ * reflects its inclusion in a "private" header file.
+ *
* Return: log2(n) (always - no failure condition)
*
* Programmer: Quincey Koziol
@@ -416,7 +439,7 @@ static const unsigned MultiplyDeBruijnBitPosition[32] = {0, 1, 28, 2, 29, 14,
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE H5_ATTR_PURE unsigned
+static inline H5_ATTR_PURE unsigned
H5VM_log2_of2(uint32_t n)
{
#ifndef NDEBUG
@@ -426,17 +449,21 @@ H5VM_log2_of2(uint32_t n)
} /* H5VM_log2_of2() */
/*-------------------------------------------------------------------------
- * Function: H5VM_power2up
+ * Function: H5VM_power2up
*
- * Purpose: Round up a number to the next power of 2
+ * Purpose: Round up a number to the next power of 2
*
- * Return: Return the number which is a power of 2
+ * Note: Although this routine is 'static' in this file, that's intended
+ * only as an optimization and the naming (with a single underscore)
+ * reflects its inclusion in a "private" header file.
*
- * Programmer: Vailin Choi; Nov 2014
+ * Return: Return the number which is a power of 2
+ *
+ * Programmer: Vailin Choi; Nov 2014
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE H5_ATTR_CONST hsize_t
+static inline H5_ATTR_CONST hsize_t
H5VM_power2up(hsize_t n)
{
hsize_t ret_value = 1; /* Return value */
@@ -457,6 +484,10 @@ H5VM_power2up(hsize_t n)
* Purpose: Determine the # of bytes needed to encode values within a
* range from 0 to a given limit
*
+ * Note: Although this routine is 'static' in this file, that's intended
+ * only as an optimization and the naming (with a single underscore)
+ * reflects its inclusion in a "private" header file.
+ *
* Return: Number of bytes needed
*
* Programmer: Quincey Koziol
@@ -464,7 +495,7 @@ H5VM_power2up(hsize_t n)
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE unsigned H5_ATTR_UNUSED
+static inline unsigned H5_ATTR_UNUSED
H5VM_limit_enc_size(uint64_t limit)
{
return (H5VM_log2_gen(limit) / 8) + 1;
@@ -478,13 +509,17 @@ static const unsigned char H5VM_bit_clear_g[8] = {0x7F, 0xBF, 0xDF, 0xEF, 0xF7,
*
* Purpose: Determine the value of the n'th bit in a buffer.
*
- * Note: No range checking on <offset> is performed!
+ * Note: No range checking on <offset> is performed!
*
- * Note #2: Bits are sequentially stored in the buffer, starting with bit
+ * Note #2: Bits are sequentially stored in the buffer, starting with bit
* offset 0 in the first byte's high-bit position, proceeding down
* to bit offset 7 in the first byte's low-bit position, then to
* bit offset 8 in the second byte's high-bit position, etc.
*
+ * Note: Although this routine is 'static' in this file, that's intended
+ * only as an optimization and the naming (with a single underscore)
+ * reflects its inclusion in a "private" header file.
+ *
* Return: TRUE/FALSE
*
* Programmer: Quincey Koziol
@@ -492,7 +527,7 @@ static const unsigned char H5VM_bit_clear_g[8] = {0x7F, 0xBF, 0xDF, 0xEF, 0xF7,
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE hbool_t H5_ATTR_UNUSED
+static inline hbool_t H5_ATTR_UNUSED
H5VM_bit_get(const unsigned char *buf, size_t offset)
{
/* Test the appropriate bit in the buffer */
@@ -504,13 +539,17 @@ H5VM_bit_get(const unsigned char *buf, size_t offset)
*
* Purpose: Set/reset the n'th bit in a buffer.
*
- * Note: No range checking on <offset> is performed!
+ * Note: No range checking on <offset> is performed!
*
- * Note #2: Bits are sequentially stored in the buffer, starting with bit
+ * Note #2: Bits are sequentially stored in the buffer, starting with bit
* offset 0 in the first byte's high-bit position, proceeding down
* to bit offset 7 in the first byte's low-bit position, then to
* bit offset 8 in the second byte's high-bit position, etc.
*
+ * Note: Although this routine is 'static' in this file, that's intended
+ * only as an optimization and the naming (with a single underscore)
+ * reflects its inclusion in a "private" header file.
+ *
* Return: None
*
* Programmer: Quincey Koziol
@@ -518,7 +557,7 @@ H5VM_bit_get(const unsigned char *buf, size_t offset)
*
*-------------------------------------------------------------------------
*/
-static H5_INLINE void H5_ATTR_UNUSED
+static inline void H5_ATTR_UNUSED
H5VM_bit_set(unsigned char *buf, size_t offset, hbool_t val)
{
/* Set/reset the appropriate bit in the buffer */