summaryrefslogtreecommitdiffstats
path: root/src/H5VMprivate.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5VMprivate.h')
-rw-r--r--src/H5VMprivate.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/H5VMprivate.h b/src/H5VMprivate.h
index 7d3361b..f402b36 100644
--- a/src/H5VMprivate.h
+++ b/src/H5VMprivate.h
@@ -49,6 +49,22 @@ typedef herr_t (*H5VM_opvv_func_t)(hsize_t dst_off, hsize_t src_off,
#define H5VM_vector_zero(N,DST) HDmemset(DST,0,(N)*sizeof(*(DST)))
+/* Given a coordinate offset array (COORDS) of type TYPE, move the unlimited
+ * dimension (UNLIM_DIM) value to offset 0, sliding any intermediate values down
+ * one position. */
+#define H5VM_swizzle_coords(TYPE,COORDS,UNLIM_DIM) { \
+ /* COORDS must be an array of type TYPE */ \
+ HDassert(sizeof(COORDS[0]) == sizeof(TYPE)); \
+ \
+ /* Nothing to do when unlimited dimension is at position 0 */ \
+ if(0 != (UNLIM_DIM)) { \
+ TYPE _tmp = (COORDS)[UNLIM_DIM]; \
+ \
+ HDmemmove(&(COORDS)[1], &(COORDS)[0], sizeof(TYPE) * (UNLIM_DIM)); \
+ (COORDS)[0] = _tmp; \
+ } /* end if */ \
+}
+
/* A null pointer is equivalent to a zero vector */
#define H5VM_ZERO NULL