summaryrefslogtreecommitdiffstats
path: root/src/H5VMprivate.h
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@lbl.gov>2020-08-06 22:46:40 (GMT)
committerQuincey Koziol <koziol@lbl.gov>2020-08-06 22:46:40 (GMT)
commit8fe3cece3c671453e4c49f22fde9d7635c08f031 (patch)
tree6dd0d609a234b413530ce696e6cff9b669cdcce4 /src/H5VMprivate.h
parent07e4ef9da47eda1f23ca72c748fbb6d4b309540b (diff)
downloadhdf5-8fe3cece3c671453e4c49f22fde9d7635c08f031.zip
hdf5-8fe3cece3c671453e4c49f22fde9d7635c08f031.tar.gz
hdf5-8fe3cece3c671453e4c49f22fde9d7635c08f031.tar.bz2
Switch H5VM inline routines back to single underscope and put a comment in their header about this naming
Diffstat (limited to 'src/H5VMprivate.h')
-rw-r--r--src/H5VMprivate.h126
1 files changed, 87 insertions, 39 deletions
diff --git a/src/H5VMprivate.h b/src/H5VMprivate.h
index eaa9657..e784847 100644
--- a/src/H5VMprivate.h
+++ b/src/H5VMprivate.h
@@ -28,16 +28,16 @@ typedef herr_t (*H5VM_opvv_func_t)(hsize_t dst_off, hsize_t src_off,
size_t len, void *udata);
/* Vector comparison functions like Fortran66 comparison operators */
-#define H5VM_vector_eq_s(N,V1,V2) (H5VM__vector_cmp_s(N, V1, V2) == 0)
-#define H5VM_vector_lt_s(N,V1,V2) (H5VM__vector_cmp_s(N, V1, V2) < 0)
-#define H5VM_vector_gt_s(N,V1,V2) (H5VM__vector_cmp_s(N, V1, V2) > 0)
-#define H5VM_vector_le_s(N,V1,V2) (H5VM__vector_cmp_s(N, V1, V2) <= 0)
-#define H5VM_vector_ge_s(N,V1,V2) (H5VM__vector_cmp_s(N, V1, V2) >= 0)
-#define H5VM_vector_eq_u(N,V1,V2) (H5VM__vector_cmp_u(N, V1, V2) == 0)
-#define H5VM_vector_lt_u(N,V1,V2) (H5VM__vector_cmp_u(N, V1, V2) < 0)
-#define H5VM_vector_gt_u(N,V1,V2) (H5VM__vector_cmp_u(N, V1, V2) > 0)
-#define H5VM_vector_le_u(N,V1,V2) (H5VM__vector_cmp_u(N, V1, V2) <= 0)
-#define H5VM_vector_ge_u(N,V1,V2) (H5VM__vector_cmp_u(N, V1, V2) >= 0)
+#define H5VM_vector_eq_s(N,V1,V2) (H5VM_vector_cmp_s(N, V1, V2) == 0)
+#define H5VM_vector_lt_s(N,V1,V2) (H5VM_vector_cmp_s(N, V1, V2) < 0)
+#define H5VM_vector_gt_s(N,V1,V2) (H5VM_vector_cmp_s(N, V1, V2) > 0)
+#define H5VM_vector_le_s(N,V1,V2) (H5VM_vector_cmp_s(N, V1, V2) <= 0)
+#define H5VM_vector_ge_s(N,V1,V2) (H5VM_vector_cmp_s(N, V1, V2) >= 0)
+#define H5VM_vector_eq_u(N,V1,V2) (H5VM_vector_cmp_u(N, V1, V2) == 0)
+#define H5VM_vector_lt_u(N,V1,V2) (H5VM_vector_cmp_u(N, V1, V2) < 0)
+#define H5VM_vector_gt_u(N,V1,V2) (H5VM_vector_cmp_u(N, V1, V2) > 0)
+#define H5VM_vector_le_u(N,V1,V2) (H5VM_vector_cmp_u(N, V1, V2) <= 0)
+#define H5VM_vector_ge_u(N,V1,V2) (H5VM_vector_cmp_u(N, V1, V2) >= 0)
/* Other functions */
#define H5VM_vector_cpy(N,DST,SRC) { \
@@ -139,13 +139,17 @@ H5_DLL ssize_t H5VM_memcpyvv(void *_dst,
/*-------------------------------------------------------------------------
- * Function: H5VM__vector_reduce_product
+ * Function: H5VM_vector_reduce_product
*
* Purpose: Product reduction of a vector. Vector elements and return
* value are size_t because we usually want the number of
* 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
@@ -156,7 +160,7 @@ H5_DLL ssize_t H5VM_memcpyvv(void *_dst,
*-------------------------------------------------------------------------
*/
static H5_INLINE hsize_t H5_ATTR_UNUSED
-H5VM__vector_reduce_product(unsigned n, const hsize_t *v)
+H5VM_vector_reduce_product(unsigned n, const hsize_t *v)
{
hsize_t ret_value = 1;
@@ -171,10 +175,14 @@ done:
}
/*-------------------------------------------------------------------------
- * Function: H5VM__vector_zerop_u
+ * Function: H5VM_vector_zerop_u
*
* 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
*
@@ -186,7 +194,7 @@ done:
*-------------------------------------------------------------------------
*/
static H5_INLINE htri_t H5_ATTR_UNUSED
-H5VM__vector_zerop_u(int n, const hsize_t *v)
+H5VM_vector_zerop_u(int n, const hsize_t *v)
{
htri_t ret_value=TRUE; /* Return value */
@@ -208,6 +216,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
*
@@ -237,11 +249,15 @@ done:
}
/*-------------------------------------------------------------------------
- * Function: H5VM__vector_cmp_u
+ * Function: H5VM_vector_cmp_u
*
* 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
@@ -254,7 +270,7 @@ done:
*-------------------------------------------------------------------------
*/
static H5_INLINE int H5_ATTR_UNUSED
-H5VM__vector_cmp_u(unsigned n, const hsize_t *v1, const hsize_t *v2)
+H5VM_vector_cmp_u(unsigned n, const hsize_t *v1, const hsize_t *v2)
{
int ret_value=0; /* Return value */
@@ -277,11 +293,15 @@ 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
@@ -294,7 +314,7 @@ done:
*-------------------------------------------------------------------------
*/
static H5_INLINE int H5_ATTR_UNUSED
-H5VM__vector_cmp_s(unsigned n, const hssize_t *v1, const hssize_t *v2)
+H5VM_vector_cmp_s(unsigned n, const hssize_t *v1, const hssize_t *v2)
{
int ret_value=0; /* Return value */
@@ -317,10 +337,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5VM__vector_inc
+ * Function: H5VM_vector_inc
*
* 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
@@ -329,7 +353,7 @@ done:
*-------------------------------------------------------------------------
*/
static H5_INLINE void H5_ATTR_UNUSED
-H5VM__vector_inc(int n, hsize_t *v1, const hsize_t *v2)
+H5VM_vector_inc(int n, hsize_t *v1, const hsize_t *v2)
{
while (n--) *v1++ += *v2++;
}
@@ -357,7 +381,7 @@ static const unsigned char LogTable256[] =
/*-------------------------------------------------------------------------
- * Function: H5VM__log2_gen
+ * Function: H5VM_log2_gen
*
* Purpose: Determines the log base two of a number (i.e. log2(n)).
* (i.e. the highest bit set in a number)
@@ -368,6 +392,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
@@ -376,7 +404,7 @@ static const unsigned char LogTable256[] =
*-------------------------------------------------------------------------
*/
static H5_INLINE unsigned H5_ATTR_UNUSED
-H5VM__log2_gen(uint64_t n)
+H5VM_log2_gen(uint64_t n)
{
unsigned r; /* r will be log2(n) */
register unsigned int t, tt, ttt; /* temporaries */
@@ -394,7 +422,7 @@ H5VM__log2_gen(uint64_t n)
r = (t = (unsigned)(n >> 8)) ? 8 + (unsigned)LogTable256[t] : (unsigned)LogTable256[(uint8_t)n];
return(r);
-} /* H5VM__log2_gen() */
+} /* H5VM_log2_gen() */
/* Lookup table for specialized log2(n) of power of two routine */
@@ -406,7 +434,7 @@ static const unsigned MultiplyDeBruijnBitPosition[32] =
/*-------------------------------------------------------------------------
- * Function: H5VM__log2_of2
+ * Function: H5VM_log2_of2
*
* Purpose: Determines the log base two of a number (i.e. log2(n)).
* (i.e. the highest bit set in a number)
@@ -416,6 +444,10 @@ static const unsigned MultiplyDeBruijnBitPosition[32] =
* 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
@@ -424,20 +456,24 @@ static const unsigned MultiplyDeBruijnBitPosition[32] =
*-------------------------------------------------------------------------
*/
static H5_INLINE H5_ATTR_PURE unsigned
-H5VM__log2_of2(uint32_t n)
+H5VM_log2_of2(uint32_t n)
{
#ifndef NDEBUG
HDassert(POWER_OF_TWO(n));
#endif /* NDEBUG */
return(MultiplyDeBruijnBitPosition[(n * (uint32_t)0x077CB531UL) >> 27]);
-} /* H5VM__log2_of2() */
+} /* H5VM_log2_of2() */
/*-------------------------------------------------------------------------
- * Function: H5VM__power2up
+ * Function: H5VM_power2up
*
* Purpose: Round up a number to the next 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.
+ *
* Return: Return the number which is a power of 2
*
* Programmer: Vailin Choi; Nov 2014
@@ -445,7 +481,7 @@ H5VM__log2_of2(uint32_t n)
*-------------------------------------------------------------------------
*/
static H5_INLINE H5_ATTR_CONST hsize_t
-H5VM__power2up(hsize_t n)
+H5VM_power2up(hsize_t n)
{
hsize_t ret_value = 1; /* Return value */
@@ -457,15 +493,19 @@ H5VM__power2up(hsize_t n)
ret_value <<= 1;
return(ret_value);
-} /* H5VM__power2up */
+} /* H5VM_power2up */
/*-------------------------------------------------------------------------
- * Function: H5VM__limit_enc_size
+ * Function: H5VM_limit_enc_size
*
* 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
@@ -474,17 +514,17 @@ H5VM__power2up(hsize_t n)
*-------------------------------------------------------------------------
*/
static H5_INLINE unsigned H5_ATTR_UNUSED
-H5VM__limit_enc_size(uint64_t limit)
+H5VM_limit_enc_size(uint64_t limit)
{
- return (H5VM__log2_gen(limit) / 8) + 1;
-} /* end H5VM__limit_enc_size() */
+ return (H5VM_log2_gen(limit) / 8) + 1;
+} /* end H5VM_limit_enc_size() */
static const unsigned char H5VM_bit_set_g[8] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
static const unsigned char H5VM_bit_clear_g[8] = {0x7F, 0xBF, 0xDF, 0xEF, 0xF7, 0xFB, 0xFD, 0xFE};
/*-------------------------------------------------------------------------
- * Function: H5VM__bit_get
+ * Function: H5VM_bit_get
*
* Purpose: Determine the value of the n'th bit in a buffer.
*
@@ -495,6 +535,10 @@ static const unsigned char H5VM_bit_clear_g[8] = {0x7F, 0xBF, 0xDF, 0xEF, 0xF7,
* 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
@@ -503,15 +547,15 @@ static const unsigned char H5VM_bit_clear_g[8] = {0x7F, 0xBF, 0xDF, 0xEF, 0xF7,
*-------------------------------------------------------------------------
*/
static H5_INLINE hbool_t H5_ATTR_UNUSED
-H5VM__bit_get(const unsigned char *buf, size_t offset)
+H5VM_bit_get(const unsigned char *buf, size_t offset)
{
/* Test the appropriate bit in the buffer */
return (hbool_t)((buf[offset / 8] & (H5VM_bit_set_g[offset % 8])) ? TRUE : FALSE);
-} /* end H5VM__bit_get() */
+} /* end H5VM_bit_get() */
/*-------------------------------------------------------------------------
- * Function: H5VM__bit_set
+ * Function: H5VM_bit_set
*
* Purpose: Set/reset the n'th bit in a buffer.
*
@@ -522,6 +566,10 @@ H5VM__bit_get(const unsigned char *buf, size_t offset)
* 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
@@ -530,14 +578,14 @@ H5VM__bit_get(const unsigned char *buf, size_t offset)
*-------------------------------------------------------------------------
*/
static H5_INLINE void H5_ATTR_UNUSED
-H5VM__bit_set(unsigned char *buf, size_t offset, hbool_t val)
+H5VM_bit_set(unsigned char *buf, size_t offset, hbool_t val)
{
/* Set/reset the appropriate bit in the buffer */
if(val)
buf[offset / 8] |= H5VM_bit_set_g[offset % 8];
else
buf[offset / 8] &= H5VM_bit_clear_g[offset % 8];
-} /* end H5VM__bit_set() */
+} /* end H5VM_bit_set() */
#endif /* H5VMprivate_H */