summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-10-20 17:18:53 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-10-20 17:18:53 (GMT)
commitd8c33ee5d42f1fdeb8722583d1812edbafa9179d (patch)
tree6f5a673225d010265bbe1087ad4160639c0a2cfa /src
parent848ea8370bbc6a496d026266d2b625b8d4d4d98b (diff)
downloadhdf5-d8c33ee5d42f1fdeb8722583d1812edbafa9179d.zip
hdf5-d8c33ee5d42f1fdeb8722583d1812edbafa9179d.tar.gz
hdf5-d8c33ee5d42f1fdeb8722583d1812edbafa9179d.tar.bz2
[svn-r7672] Purpose:
Code cleanup/refactoring/potential bug fix Description: Migrate "template macro" changes from development branch back into this branch, since they give about a 20% speedup for integer & floating-point type conversions. The also avoid a potential alignment bug on the Crays... Platforms tested: FreeBSD 4.9 (sleipnir) h5committest not necessary, since the changes are already verified in the development branch.
Diffstat (limited to 'src')
-rw-r--r--src/H5T.c1613
-rw-r--r--src/H5Tconv.c725
-rw-r--r--src/H5private.h4
3 files changed, 688 insertions, 1654 deletions
diff --git a/src/H5T.c b/src/H5T.c
index f27a8f0..e853584 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -246,6 +246,194 @@ static herr_t H5T_unregister(H5T_pers_t pers, const char *name, H5T_t *src,
static herr_t H5T_register(H5T_pers_t pers, const char *name, H5T_t *src,
H5T_t *dst, H5T_conv_t func, hid_t dxpl_id);
+/*
+ * Type initialization macros
+ *
+ * These use the "template macro" technique to reduce the amount of gratuitous
+ * duplicated code when initializing the datatypes for the library. The main
+ * template macro is the H5T_INIT_TYPE() macro below.
+ *
+ */
+
+/* Define the code template for types which need no extra initialization for the "GUTS" in the H5T_INIT_TYPE macro */
+#define H5T_INIT_TYPE_NONE_CORE { \
+}
+
+/* Define the code template for bitfields for the "GUTS" in the H5T_INIT_TYPE macro */
+#define H5T_INIT_TYPE_BITFIELD_CORE { \
+ dt->type = H5T_BITFIELD; \
+}
+
+/* Define the code template for times for the "GUTS" in the H5T_INIT_TYPE macro */
+#define H5T_INIT_TYPE_TIME_CORE { \
+ dt->type = H5T_TIME; \
+}
+
+/* Define the code template for types which reset the offset for the "GUTS" in the H5T_INIT_TYPE macro */
+#define H5T_INIT_TYPE_OFFSET_CORE { \
+ dt->u.atomic.offset = 0; \
+}
+
+/* Define common code for all numeric types (floating-point & int, signed & unsigned) */
+#define H5T_INIT_TYPE_NUM_COMMON(ENDIANNESS) { \
+ dt->u.atomic.order = ENDIANNESS; \
+ dt->u.atomic.offset = 0; \
+ dt->u.atomic.lsb_pad = H5T_PAD_ZERO; \
+ dt->u.atomic.msb_pad = H5T_PAD_ZERO; \
+}
+
+/* Define the code templates for standard floats for the "GUTS" in the H5T_INIT_TYPE macro */
+#define H5T_INIT_TYPE_FLOAT_COMMON(ENDIANNESS) { \
+ H5T_INIT_TYPE_NUM_COMMON(ENDIANNESS) \
+ dt->u.atomic.u.f.sign = 31; \
+ dt->u.atomic.u.f.epos = 23; \
+ dt->u.atomic.u.f.esize = 8; \
+ dt->u.atomic.u.f.ebias = 0x7f; \
+ dt->u.atomic.u.f.mpos = 0; \
+ dt->u.atomic.u.f.msize = 23; \
+ dt->u.atomic.u.f.norm = H5T_NORM_IMPLIED; \
+ dt->u.atomic.u.f.pad = H5T_PAD_ZERO; \
+}
+
+#define H5T_INIT_TYPE_FLOATLE_CORE { \
+ H5T_INIT_TYPE_FLOAT_COMMON(H5T_ORDER_LE) \
+}
+
+#define H5T_INIT_TYPE_FLOATBE_CORE { \
+ H5T_INIT_TYPE_FLOAT_COMMON(H5T_ORDER_BE) \
+}
+
+/* Define the code templates for standard doubles for the "GUTS" in the H5T_INIT_TYPE macro */
+#define H5T_INIT_TYPE_DOUBLE_COMMON(ENDIANNESS) { \
+ H5T_INIT_TYPE_NUM_COMMON(ENDIANNESS) \
+ dt->u.atomic.u.f.sign = 63; \
+ dt->u.atomic.u.f.epos = 52; \
+ dt->u.atomic.u.f.esize = 11; \
+ dt->u.atomic.u.f.ebias = 0x03ff; \
+ dt->u.atomic.u.f.mpos = 0; \
+ dt->u.atomic.u.f.msize = 52; \
+ dt->u.atomic.u.f.norm = H5T_NORM_IMPLIED; \
+ dt->u.atomic.u.f.pad = H5T_PAD_ZERO; \
+}
+
+#define H5T_INIT_TYPE_DOUBLELE_CORE { \
+ H5T_INIT_TYPE_DOUBLE_COMMON(H5T_ORDER_LE) \
+}
+
+#define H5T_INIT_TYPE_DOUBLEBE_CORE { \
+ H5T_INIT_TYPE_DOUBLE_COMMON(H5T_ORDER_BE) \
+}
+
+/* Define the code templates for standard signed integers for the "GUTS" in the H5T_INIT_TYPE macro */
+#define H5T_INIT_TYPE_SINT_COMMON(ENDIANNESS) { \
+ H5T_INIT_TYPE_NUM_COMMON(ENDIANNESS) \
+ dt->u.atomic.u.i.sign = H5T_SGN_2; \
+}
+
+#define H5T_INIT_TYPE_SINTLE_CORE { \
+ H5T_INIT_TYPE_SINT_COMMON(H5T_ORDER_LE) \
+}
+
+#define H5T_INIT_TYPE_SINTBE_CORE { \
+ H5T_INIT_TYPE_SINT_COMMON(H5T_ORDER_BE) \
+}
+
+/* Define the code templates for standard unsigned integers for the "GUTS" in the H5T_INIT_TYPE macro */
+#define H5T_INIT_TYPE_UINT_COMMON(ENDIANNESS) { \
+ H5T_INIT_TYPE_NUM_COMMON(ENDIANNESS) \
+ dt->u.atomic.u.i.sign = H5T_SGN_NONE; \
+}
+
+#define H5T_INIT_TYPE_UINTLE_CORE { \
+ H5T_INIT_TYPE_UINT_COMMON(H5T_ORDER_LE) \
+}
+
+#define H5T_INIT_TYPE_UINTBE_CORE { \
+ H5T_INIT_TYPE_UINT_COMMON(H5T_ORDER_BE) \
+}
+
+/* Define a macro for common code for all newly allocate datatypes */
+#define H5T_INIT_TYPE_ALLOC_COMMON(TYPE) { \
+ dt->ent.header = HADDR_UNDEF; \
+ dt->type = TYPE; \
+}
+
+/* Define the code templates for opaque for the "GUTS" in the H5T_INIT_TYPE macro */
+#define H5T_INIT_TYPE_OPAQUE_CORE { \
+ H5T_INIT_TYPE_ALLOC_COMMON(H5T_OPAQUE) \
+ dt->u.opaque.tag = H5MM_strdup(""); \
+}
+
+/* Define the code templates for strings for the "GUTS" in the H5T_INIT_TYPE macro */
+#define H5T_INIT_TYPE_STRING_COMMON { \
+ H5T_INIT_TYPE_ALLOC_COMMON(H5T_STRING) \
+ H5T_INIT_TYPE_NUM_COMMON(H5T_ORDER_NONE) \
+ dt->u.atomic.u.s.cset = H5T_CSET_ASCII; \
+}
+
+#define H5T_INIT_TYPE_CSTRING_CORE { \
+ H5T_INIT_TYPE_STRING_COMMON \
+ dt->u.atomic.u.s.pad = H5T_STR_NULLTERM; \
+}
+
+#define H5T_INIT_TYPE_FORSTRING_CORE { \
+ H5T_INIT_TYPE_STRING_COMMON \
+ dt->u.atomic.u.s.pad = H5T_STR_SPACEPAD; \
+}
+
+/* Define the code templates for references for the "GUTS" in the H5T_INIT_TYPE macro */
+#define H5T_INIT_TYPE_REF_COMMON(RTYPE) { \
+ H5T_INIT_TYPE_ALLOC_COMMON(H5T_REFERENCE) \
+ H5T_INIT_TYPE_NUM_COMMON(H5T_ORDER_NONE) \
+ dt->u.atomic.u.r.rtype = RTYPE; \
+}
+
+#define H5T_INIT_TYPE_OBJREF_CORE { \
+ H5T_INIT_TYPE_REF_COMMON(H5R_OBJECT) \
+}
+
+#define H5T_INIT_TYPE_REGREF_CORE { \
+ H5T_INIT_TYPE_REF_COMMON(H5R_DATASET_REGION) \
+}
+
+/* Define the code templates for the "SIZE_TMPL" in the H5T_INIT_TYPE macro */
+#define H5T_INIT_TYPE_SET_SIZE(SIZE) { \
+ dt->size = SIZE; \
+ dt->u.atomic.prec = 8*SIZE; \
+}
+
+#define H5T_INIT_TYPE_NOSET_SIZE(SIZE) { \
+}
+
+/* Define the code templates for the "CRT_TMPL" in the H5T_INIT_TYPE macro */
+#define H5T_INIT_TYPE_COPY_CREATE(BASE) { \
+ /* Base off of existing datatype */ \
+ if(NULL==(dt = H5T_copy(BASE,H5T_COPY_TRANSIENT))) \
+ HGOTO_ERROR (H5E_RESOURCE, H5E_CANTCOPY, FAIL, "duplicating base type failed") \
+}
+
+#define H5T_INIT_TYPE_ALLOC_CREATE(BASE) { \
+ /* Allocate new datatype info */ \
+ if (NULL==(dt = H5FL_CALLOC(H5T_t))) \
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") \
+}
+
+#define H5T_INIT_TYPE(GUTS,GLOBAL,CRT_TMPL,BASE,SIZE_TMPL,SIZE) { \
+ /* Get new datatype struct */ \
+ H5_GLUE3(H5T_INIT_TYPE_,CRT_TMPL,_CREATE)(BASE) \
+ \
+ /* Adjust information for all types */ \
+ dt->state = H5T_STATE_IMMUTABLE; \
+ H5_GLUE3(H5T_INIT_TYPE_,SIZE_TMPL,_SIZE)(SIZE) \
+ \
+ /* Adjust information for this type */ \
+ H5_GLUE3(H5T_INIT_TYPE_,GUTS,_CORE) \
+ \
+ /* Atomize result */ \
+ if ((GLOBAL = H5I_register(H5I_DATATYPE, dt)) < 0) \
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom") \
+}
+
/*-------------------------------------------------------------------------
* Function: H5T_init
@@ -303,8 +491,15 @@ H5T_init_interface(void)
H5T_t *native_ullong=NULL; /* Datatype structure for native unsigned llong */
H5T_t *native_float=NULL; /* Datatype structure for native float */
H5T_t *native_double=NULL; /* Datatype structure for native double */
+ H5T_t *std_u8le=NULL; /* Datatype structure for unsigned 8-bit little-endian integer */
+ H5T_t *std_u8be=NULL; /* Datatype structure for unsigned 8-bit big-endian integer */
+ H5T_t *std_u16le=NULL; /* Datatype structure for unsigned 16-bit little-endian integer */
+ H5T_t *std_u16be=NULL; /* Datatype structure for unsigned 16-bit big-endian integer */
H5T_t *std_u32le=NULL; /* Datatype structure for unsigned 32-bit little-endian integer */
+ H5T_t *std_u32be=NULL; /* Datatype structure for unsigned 32-bit big-endian integer */
H5T_t *std_i32le=NULL; /* Datatype structure for signed 32-bit little-endian integer */
+ H5T_t *std_u64le=NULL; /* Datatype structure for unsigned 64-bit little-endian integer */
+ H5T_t *std_u64be=NULL; /* Datatype structure for unsigned 64-bit big-endian integer */
H5T_t *ieee_f64le=NULL; /* Datatype structure for IEEE 64-bit little-endian floating-point */
H5T_t *dt = NULL;
H5T_t *fixedpt=NULL; /* Datatype structure for native int */
@@ -363,1285 +558,233 @@ H5T_init_interface(void)
if (NULL==(native_double=H5I_object(H5T_NATIVE_DOUBLE_g)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object");
- /*------------------------------------------------------------
- * Defaults for C9x types
- *------------------------------------------------------------
- */
-
- /* int8 */
- if (H5T_NATIVE_INT8_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_int,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 1;
- dt->u.atomic.prec = 8;
-
- /* Atomize result */
- if ((H5T_NATIVE_INT8_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
- if (H5T_NATIVE_UINT8_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_uint,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 1;
- dt->u.atomic.prec = 8;
-
- /* Atomize result */
- if ((H5T_NATIVE_UINT8_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- }
- if (H5T_NATIVE_INT_LEAST8_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_int,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 1;
- dt->u.atomic.prec = 8;
-
- /* Atomize result */
- if ((H5T_NATIVE_INT_LEAST8_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- }
- if (H5T_NATIVE_UINT_LEAST8_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_uint,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 1;
- dt->u.atomic.prec = 8;
-
- /* Atomize result */
- if ((H5T_NATIVE_UINT_LEAST8_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- }
- if (H5T_NATIVE_INT_FAST8_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_int,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 1;
- dt->u.atomic.prec = 8;
-
- /* Atomize result */
- if ((H5T_NATIVE_INT_FAST8_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- }
- if (H5T_NATIVE_UINT_FAST8_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_uint,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 1;
- dt->u.atomic.prec = 8;
-
- /* Atomize result */
- if ((H5T_NATIVE_UINT_FAST8_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- }
-
- /* int16 */
- if (H5T_NATIVE_INT16_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_int,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 2;
- dt->u.atomic.prec = 16;
-
- /* Atomize result */
- if ((H5T_NATIVE_INT16_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- }
- if (H5T_NATIVE_UINT16_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_uint,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 2;
- dt->u.atomic.prec = 16;
-
- /* Atomize result */
- if ((H5T_NATIVE_UINT16_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- }
- if (H5T_NATIVE_INT_LEAST16_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_int,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 2;
- dt->u.atomic.prec = 16;
-
- /* Atomize result */
- if ((H5T_NATIVE_INT_LEAST16_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- }
- if (H5T_NATIVE_UINT_LEAST16_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_uint,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 2;
- dt->u.atomic.prec = 16;
-
- /* Atomize result */
- if ((H5T_NATIVE_UINT_LEAST16_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- }
- if (H5T_NATIVE_INT_FAST16_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_int,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 2;
- dt->u.atomic.prec = 16;
-
- /* Atomize result */
- if ((H5T_NATIVE_INT_FAST16_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- }
- if (H5T_NATIVE_UINT_FAST16_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_uint,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 2;
- dt->u.atomic.prec = 16;
-
- /* Atomize result */
- if ((H5T_NATIVE_UINT_FAST16_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- }
-
- /* int32 */
- if (H5T_NATIVE_INT32_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_int,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 4;
- dt->u.atomic.prec = 32;
-
- /* Atomize result */
- if ((H5T_NATIVE_INT32_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- }
- if (H5T_NATIVE_UINT32_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_uint,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 4;
- dt->u.atomic.prec = 32;
-
- /* Atomize result */
- if ((H5T_NATIVE_UINT32_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- }
- if (H5T_NATIVE_INT_LEAST32_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_int,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 4;
- dt->u.atomic.prec = 32;
-
- /* Atomize result */
- if ((H5T_NATIVE_INT_LEAST32_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- }
- if (H5T_NATIVE_UINT_LEAST32_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_uint,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 4;
- dt->u.atomic.prec = 32;
-
- /* Atomize result */
- if ((H5T_NATIVE_UINT_LEAST32_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- }
- if (H5T_NATIVE_INT_FAST32_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_int,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 4;
- dt->u.atomic.prec = 32;
-
- /* Atomize result */
- if ((H5T_NATIVE_INT_FAST32_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- }
- if (H5T_NATIVE_UINT_FAST32_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_uint,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 4;
- dt->u.atomic.prec = 32;
-
- /* Atomize result */
- if ((H5T_NATIVE_UINT_FAST32_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- }
-
- /* int64 */
- if (H5T_NATIVE_INT64_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_int,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 8;
- dt->u.atomic.prec = 64;
-
- /* Atomize result */
- if ((H5T_NATIVE_INT64_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- }
- if (H5T_NATIVE_UINT64_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_uint,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 8;
- dt->u.atomic.prec = 64;
-
- /* Atomize result */
- if ((H5T_NATIVE_UINT64_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- }
- if (H5T_NATIVE_INT_LEAST64_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_int,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 8;
- dt->u.atomic.prec = 64;
-
- /* Atomize result */
- if ((H5T_NATIVE_INT_LEAST64_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- }
- if (H5T_NATIVE_UINT_LEAST64_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_uint,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 8;
- dt->u.atomic.prec = 64;
-
- /* Atomize result */
- if ((H5T_NATIVE_UINT_LEAST64_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- }
- if (H5T_NATIVE_INT_FAST64_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_int,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 8;
- dt->u.atomic.prec = 64;
-
- /* Atomize result */
- if ((H5T_NATIVE_INT_FAST64_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- }
- if (H5T_NATIVE_UINT_FAST64_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_uint,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 8;
- dt->u.atomic.prec = 64;
-
- /* Atomize result */
- if ((H5T_NATIVE_UINT_FAST64_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- }
-
-
- /*------------------------------------------------------------
- * Native types
- *------------------------------------------------------------
+ /* Use this global as a proxy for all the globals, since they all get
+ * initialized and shutdown at the same time.
*/
+ if(H5T_NATIVE_INT_LEAST8_g<0) {
+ /*------------------------------------------------------------
+ * Defaults for C9x types
+ *------------------------------------------------------------
+ */
- /* 1-byte bit field */
- if(H5T_NATIVE_B8_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_uint,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->type = H5T_BITFIELD;
- dt->size = 1;
- dt->u.atomic.prec = 8;
-
- /* Atomize result */
- if ((H5T_NATIVE_B8_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
-
- /* 2-byte bit field */
- if(H5T_NATIVE_B16_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_uint,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->type = H5T_BITFIELD;
- dt->size = 2;
- dt->u.atomic.prec = 16;
-
- /* Atomize result */
- if ((H5T_NATIVE_B16_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
-
- /* 4-byte bit field */
- if(H5T_NATIVE_B32_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_uint,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->type = H5T_BITFIELD;
- dt->size = 4;
- dt->u.atomic.prec = 32;
-
- /* Atomize result */
- if ((H5T_NATIVE_B32_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
-
- /* 8-byte bit field */
- if(H5T_NATIVE_B64_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_uint,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->type = H5T_BITFIELD;
- dt->size = 8;
- dt->u.atomic.prec = 64;
-
- /* Atomize result */
- if ((H5T_NATIVE_B64_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
-
- /* haddr_t */
- if(H5T_NATIVE_HADDR_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_uint,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = sizeof(haddr_t);
- dt->u.atomic.prec = 8*dt->size;
- dt->u.atomic.offset = 0;
-
- /* Atomize result */
- if ((H5T_NATIVE_HADDR_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
-
- /* hsize_t */
- if(H5T_NATIVE_HSIZE_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_uint,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = sizeof(hsize_t);
- dt->u.atomic.prec = 8*dt->size;
- dt->u.atomic.offset = 0;
-
- /* Atomize result */
- if ((H5T_NATIVE_HSIZE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
-
- /* hssize_t */
- if(H5T_NATIVE_HSSIZE_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_int,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = sizeof(hssize_t);
- dt->u.atomic.prec = 8*dt->size;
- dt->u.atomic.offset = 0;
-
- /* Atomize result */
- if ((H5T_NATIVE_HSSIZE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
-
- /* herr_t */
- if(H5T_NATIVE_HERR_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_int,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = sizeof(herr_t);
- dt->u.atomic.prec = 8*dt->size;
- dt->u.atomic.offset = 0;
-
- /* Atomize result */
- if ((H5T_NATIVE_HERR_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
-
- /* hbool_t */
- if(H5T_NATIVE_HBOOL_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_int,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = sizeof(hbool_t);
- dt->u.atomic.prec = 8*dt->size;
- dt->u.atomic.offset = 0;
-
- /* Atomize result */
- if ((H5T_NATIVE_HBOOL_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
-
- /*------------------------------------------------------------
- * IEEE Types
- *------------------------------------------------------------
- */
-
- /* IEEE 4-byte little-endian float */
- if (H5T_IEEE_F32LE_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_double,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 4;
- dt->u.atomic.offset = 0;
- dt->u.atomic.prec = 32;
- dt->u.atomic.order = H5T_ORDER_LE;
- dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
- dt->u.atomic.msb_pad = H5T_PAD_ZERO;
- dt->u.atomic.u.f.sign = 31;
- dt->u.atomic.u.f.epos = 23;
- dt->u.atomic.u.f.esize = 8;
- dt->u.atomic.u.f.ebias = 0x7f;
- dt->u.atomic.u.f.mpos = 0;
- dt->u.atomic.u.f.msize = 23;
- dt->u.atomic.u.f.norm = H5T_NORM_IMPLIED;
- dt->u.atomic.u.f.pad = H5T_PAD_ZERO;
-
- /* Atomize result */
- if ((H5T_IEEE_F32LE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
-
- /* IEEE 4-byte big-endian float */
- if (H5T_IEEE_F32BE_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_double,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 4;
- dt->u.atomic.offset = 0;
- dt->u.atomic.prec = 32;
- dt->u.atomic.order = H5T_ORDER_BE;
- dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
- dt->u.atomic.msb_pad = H5T_PAD_ZERO;
- dt->u.atomic.u.f.sign = 31;
- dt->u.atomic.u.f.epos = 23;
- dt->u.atomic.u.f.esize = 8;
- dt->u.atomic.u.f.ebias = 0x7f;
- dt->u.atomic.u.f.mpos = 0;
- dt->u.atomic.u.f.msize = 23;
- dt->u.atomic.u.f.norm = H5T_NORM_IMPLIED;
- dt->u.atomic.u.f.pad = H5T_PAD_ZERO;
-
- /* Atomize result */
- if ((H5T_IEEE_F32BE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
+ /* int8 */
+ H5T_INIT_TYPE(NONE,H5T_NATIVE_INT_LEAST8_g,COPY,native_int,SET,1)
+ H5T_INIT_TYPE(NONE,H5T_NATIVE_UINT_LEAST8_g,COPY,native_uint,SET,1)
+ H5T_INIT_TYPE(NONE,H5T_NATIVE_INT_FAST8_g,COPY,native_int,SET,1)
+ H5T_INIT_TYPE(NONE,H5T_NATIVE_UINT_FAST8_g,COPY,native_uint,SET,1)
+
+ /* int16 */
+ H5T_INIT_TYPE(NONE,H5T_NATIVE_INT_LEAST16_g,COPY,native_int,SET,2)
+ H5T_INIT_TYPE(NONE,H5T_NATIVE_UINT_LEAST16_g,COPY,native_uint,SET,2)
+ H5T_INIT_TYPE(NONE,H5T_NATIVE_INT_FAST16_g,COPY,native_int,SET,2)
+ H5T_INIT_TYPE(NONE,H5T_NATIVE_UINT_FAST16_g,COPY,native_uint,SET,2)
+
+ /* int32 */
+ H5T_INIT_TYPE(NONE,H5T_NATIVE_INT_LEAST32_g,COPY,native_int,SET,4)
+ H5T_INIT_TYPE(NONE,H5T_NATIVE_UINT_LEAST32_g,COPY,native_uint,SET,4)
+ H5T_INIT_TYPE(NONE,H5T_NATIVE_INT_FAST32_g,COPY,native_int,SET,4)
+ H5T_INIT_TYPE(NONE,H5T_NATIVE_UINT_FAST32_g,COPY,native_uint,SET,4)
+
+ /* int64 */
+ H5T_INIT_TYPE(NONE,H5T_NATIVE_INT_LEAST64_g,COPY,native_int,SET,8)
+ H5T_INIT_TYPE(NONE,H5T_NATIVE_UINT_LEAST64_g,COPY,native_uint,SET,8)
+ H5T_INIT_TYPE(NONE,H5T_NATIVE_INT_FAST64_g,COPY,native_int,SET,8)
+ H5T_INIT_TYPE(NONE,H5T_NATIVE_UINT_FAST64_g,COPY,native_uint,SET,8)
+
- /* IEEE 8-byte little-endian float */
- if (H5T_IEEE_F64LE_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_double,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 8;
- dt->u.atomic.offset = 0;
- dt->u.atomic.prec = 64;
- dt->u.atomic.order = H5T_ORDER_LE;
- dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
- dt->u.atomic.msb_pad = H5T_PAD_ZERO;
- dt->u.atomic.u.f.sign = 63;
- dt->u.atomic.u.f.epos = 52;
- dt->u.atomic.u.f.esize = 11;
- dt->u.atomic.u.f.ebias = 0x03ff;
- dt->u.atomic.u.f.mpos = 0;
- dt->u.atomic.u.f.msize = 52;
- dt->u.atomic.u.f.norm = H5T_NORM_IMPLIED;
- dt->u.atomic.u.f.pad = H5T_PAD_ZERO;
-
- /* Atomize result */
- if ((H5T_IEEE_F64LE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
+ /*------------------------------------------------------------
+ * Native types
+ *------------------------------------------------------------
+ */
- /* IEEE 8-byte big-endian float */
- if (H5T_IEEE_F64BE_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_double,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 8;
- dt->u.atomic.offset = 0;
- dt->u.atomic.prec = 64;
- dt->u.atomic.order = H5T_ORDER_BE;
- dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
- dt->u.atomic.msb_pad = H5T_PAD_ZERO;
- dt->u.atomic.u.f.sign = 63;
- dt->u.atomic.u.f.epos = 52;
- dt->u.atomic.u.f.esize = 11;
- dt->u.atomic.u.f.ebias = 0x03ff;
- dt->u.atomic.u.f.mpos = 0;
- dt->u.atomic.u.f.msize = 52;
- dt->u.atomic.u.f.norm = H5T_NORM_IMPLIED;
- dt->u.atomic.u.f.pad = H5T_PAD_ZERO;
-
- /* Atomize result */
- if ((H5T_IEEE_F64BE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
+ /* 1-byte bit field */
+ H5T_INIT_TYPE(BITFIELD,H5T_NATIVE_B8_g,COPY,native_uint,SET,1)
+
+ /* 2-byte bit field */
+ H5T_INIT_TYPE(BITFIELD,H5T_NATIVE_B16_g,COPY,native_uint,SET,2)
+
+ /* 4-byte bit field */
+ H5T_INIT_TYPE(BITFIELD,H5T_NATIVE_B32_g,COPY,native_uint,SET,4)
+
+ /* 8-byte bit field */
+ H5T_INIT_TYPE(BITFIELD,H5T_NATIVE_B64_g,COPY,native_uint,SET,8)
+
+ /* haddr_t */
+ H5T_INIT_TYPE(OFFSET,H5T_NATIVE_HADDR_g,COPY,native_uint,SET,sizeof(haddr_t))
- /*------------------------------------------------------------
- * Other "standard" types
- *------------------------------------------------------------
- */
-
+ /* hsize_t */
+ H5T_INIT_TYPE(OFFSET,H5T_NATIVE_HSIZE_g,COPY,native_uint,SET,sizeof(hsize_t))
+
+ /* hssize_t */
+ H5T_INIT_TYPE(OFFSET,H5T_NATIVE_HSSIZE_g,COPY,native_int,SET,sizeof(hssize_t))
+
+ /* herr_t */
+ H5T_INIT_TYPE(OFFSET,H5T_NATIVE_HERR_g,COPY,native_int,SET,sizeof(herr_t))
- /* 1-byte little-endian (endianness is irrelevant) signed integer */
- if(H5T_STD_I8LE_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_int,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 1;
- dt->u.atomic.offset = 0;
- dt->u.atomic.prec = 8;
- dt->u.atomic.order = H5T_ORDER_LE;
- dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
- dt->u.atomic.msb_pad = H5T_PAD_ZERO;
- dt->u.atomic.u.i.sign = H5T_SGN_2;
-
- /* Atomize result */
- if ((H5T_STD_I8LE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
-
- /* 1-byte big-endian (endianness is irrelevant) signed integer */
- if(H5T_STD_I8BE_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_int,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 1;
- dt->u.atomic.offset = 0;
- dt->u.atomic.prec = 8;
- dt->u.atomic.order = H5T_ORDER_BE;
- dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
- dt->u.atomic.msb_pad = H5T_PAD_ZERO;
- dt->u.atomic.u.i.sign = H5T_SGN_2;
-
- /* Atomize result */
- if ((H5T_STD_I8BE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
-
- /* 2-byte little-endian signed integer */
- if(H5T_STD_I16LE_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_int,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 2;
- dt->u.atomic.offset = 0;
- dt->u.atomic.prec = 16;
- dt->u.atomic.order = H5T_ORDER_LE;
- dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
- dt->u.atomic.msb_pad = H5T_PAD_ZERO;
- dt->u.atomic.u.i.sign = H5T_SGN_2;
-
- /* Atomize result */
- if ((H5T_STD_I16LE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
-
- /* 2-byte big-endian signed integer */
- if(H5T_STD_I16BE_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_int,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 2;
- dt->u.atomic.offset = 0;
- dt->u.atomic.prec = 16;
- dt->u.atomic.order = H5T_ORDER_BE;
- dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
- dt->u.atomic.msb_pad = H5T_PAD_ZERO;
- dt->u.atomic.u.i.sign = H5T_SGN_2;
-
- /* Atomize result */
- if ((H5T_STD_I16BE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
-
- /* 4-byte little-endian signed integer */
- if(H5T_STD_I32LE_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_int,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 4;
- dt->u.atomic.offset = 0;
- dt->u.atomic.prec = 32;
- dt->u.atomic.order = H5T_ORDER_LE;
- dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
- dt->u.atomic.msb_pad = H5T_PAD_ZERO;
- dt->u.atomic.u.i.sign = H5T_SGN_2;
-
- /* Atomize result */
- if ((H5T_STD_I32LE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
-
- /* 4-byte big-endian signed integer */
- if(H5T_STD_I32BE_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_int,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 4;
- dt->u.atomic.offset = 0;
- dt->u.atomic.prec = 32;
- dt->u.atomic.order = H5T_ORDER_BE;
- dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
- dt->u.atomic.msb_pad = H5T_PAD_ZERO;
- dt->u.atomic.u.i.sign = H5T_SGN_2;
-
- /* Atomize result */
- if ((H5T_STD_I32BE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
-
- /* 8-byte little-endian signed integer */
- if(H5T_STD_I64LE_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_int,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 8;
- dt->u.atomic.offset = 0;
- dt->u.atomic.prec = 64;
- dt->u.atomic.order = H5T_ORDER_LE;
- dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
- dt->u.atomic.msb_pad = H5T_PAD_ZERO;
- dt->u.atomic.u.i.sign = H5T_SGN_2;
-
- /* Atomize result */
- if ((H5T_STD_I64LE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
-
- /* 8-byte big-endian signed integer */
- if(H5T_STD_I64BE_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_int,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 8;
- dt->u.atomic.offset = 0;
- dt->u.atomic.prec = 64;
- dt->u.atomic.order = H5T_ORDER_BE;
- dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
- dt->u.atomic.msb_pad = H5T_PAD_ZERO;
- dt->u.atomic.u.i.sign = H5T_SGN_2;
-
- /* Atomize result */
- if ((H5T_STD_I64BE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
-
- /* 1-byte little-endian (endianness is irrelevant) unsigned integer */
- if(H5T_STD_U8LE_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_uint,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 1;
- dt->u.atomic.offset = 0;
- dt->u.atomic.prec = 8;
- dt->u.atomic.order = H5T_ORDER_LE;
- dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
- dt->u.atomic.msb_pad = H5T_PAD_ZERO;
- dt->u.atomic.u.i.sign = H5T_SGN_NONE;
-
- /* Atomize result */
- if ((H5T_STD_U8LE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
+ /* hbool_t */
+ H5T_INIT_TYPE(OFFSET,H5T_NATIVE_HBOOL_g,COPY,native_int,SET,sizeof(hbool_t))
- /*
- * Register little-endian (order is irrelevant) 8-bit bitfield now also
+ /*------------------------------------------------------------
+ * IEEE Types
+ *------------------------------------------------------------
*/
- /* Base off of current datatype */
- dt = H5T_copy(dt,H5T_COPY_TRANSIENT);
- assert(dt);
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->type = H5T_BITFIELD;
+ /* IEEE 4-byte little-endian float */
+ H5T_INIT_TYPE(FLOATLE,H5T_IEEE_F32LE_g,COPY,native_double,SET,4)
- /* Atomize result */
- if ((H5T_STD_B8LE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
-
- /* 1-byte big-endian (endianness is irrelevant) unsigned integer */
- if(H5T_STD_U8BE_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_uint,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 1;
- dt->u.atomic.offset = 0;
- dt->u.atomic.prec = 8;
- dt->u.atomic.order = H5T_ORDER_BE;
- dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
- dt->u.atomic.msb_pad = H5T_PAD_ZERO;
- dt->u.atomic.u.i.sign = H5T_SGN_NONE;
-
- /* Atomize result */
- if ((H5T_STD_U8BE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
+ /* IEEE 4-byte big-endian float */
+ H5T_INIT_TYPE(FLOATBE,H5T_IEEE_F32BE_g,COPY,native_double,SET,4)
- /*
- * Register big-endian (order is irrelevant) 8-bit bitfield now also
- */
- /* Base off of current datatype */
- dt = H5T_copy(dt,H5T_COPY_TRANSIENT);
- assert(dt);
+ /* IEEE 8-byte little-endian float */
+ H5T_INIT_TYPE(DOUBLELE,H5T_IEEE_F64LE_g,COPY,native_double,SET,8)
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->type = H5T_BITFIELD;
+ /* IEEE 8-byte big-endian float */
+ H5T_INIT_TYPE(DOUBLEBE,H5T_IEEE_F64BE_g,COPY,native_double,SET,8)
- /* Atomize result */
- if ((H5T_STD_B8BE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
-
- /* 2-byte little-endian unsigned integer */
- if(H5T_STD_U16LE_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_uint,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 2;
- dt->u.atomic.offset = 0;
- dt->u.atomic.prec = 16;
- dt->u.atomic.order = H5T_ORDER_LE;
- dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
- dt->u.atomic.msb_pad = H5T_PAD_ZERO;
- dt->u.atomic.u.i.sign = H5T_SGN_NONE;
-
- /* Atomize result */
- if ((H5T_STD_U16LE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
-
- /*
- * Register little-endian 16-bit bitfield now also
+ /*------------------------------------------------------------
+ * Other "standard" types
+ *------------------------------------------------------------
*/
- /* Base off of current datatype */
- dt = H5T_copy(dt,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->type = H5T_BITFIELD;
+
- /* Atomize result */
- if ((H5T_STD_B16LE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
-
- /* 2-byte big-endian unsigned integer */
- if(H5T_STD_U16BE_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_uint,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 2;
- dt->u.atomic.offset = 0;
- dt->u.atomic.prec = 16;
- dt->u.atomic.order = H5T_ORDER_BE;
- dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
- dt->u.atomic.msb_pad = H5T_PAD_ZERO;
- dt->u.atomic.u.i.sign = H5T_SGN_NONE;
-
- /* Atomize result */
- if ((H5T_STD_U16BE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
+ /* 1-byte little-endian (endianness is irrelevant) signed integer */
+ H5T_INIT_TYPE(SINTLE,H5T_STD_I8LE_g,COPY,native_int,SET,1)
+
+ /* 1-byte big-endian (endianness is irrelevant) signed integer */
+ H5T_INIT_TYPE(SINTBE,H5T_STD_I8BE_g,COPY,native_int,SET,1)
+
+ /* 2-byte little-endian signed integer */
+ H5T_INIT_TYPE(SINTLE,H5T_STD_I16LE_g,COPY,native_int,SET,2)
+
+ /* 2-byte big-endian signed integer */
+ H5T_INIT_TYPE(SINTBE,H5T_STD_I16BE_g,COPY,native_int,SET,2)
+
+ /* 4-byte little-endian signed integer */
+ H5T_INIT_TYPE(SINTLE,H5T_STD_I32LE_g,COPY,native_int,SET,4)
+
+ /* 4-byte big-endian signed integer */
+ H5T_INIT_TYPE(SINTBE,H5T_STD_I32BE_g,COPY,native_int,SET,4)
+
+ /* 8-byte little-endian signed integer */
+ H5T_INIT_TYPE(SINTLE,H5T_STD_I64LE_g,COPY,native_int,SET,8)
+
+ /* 8-byte big-endian signed integer */
+ H5T_INIT_TYPE(SINTBE,H5T_STD_I64BE_g,COPY,native_int,SET,8)
+
+ /* 1-byte little-endian (endianness is irrelevant) unsigned integer */
+ H5T_INIT_TYPE(UINTLE,H5T_STD_U8LE_g,COPY,native_uint,SET,1)
+ std_u8le=dt; /* Keep type for later */
+
+ /* 1-byte big-endian (endianness is irrelevant) unsigned integer */
+ H5T_INIT_TYPE(UINTBE,H5T_STD_U8BE_g,COPY,native_uint,SET,1)
+ std_u8be=dt; /* Keep type for later */
+
+ /* 2-byte little-endian unsigned integer */
+ H5T_INIT_TYPE(UINTLE,H5T_STD_U16LE_g,COPY,native_uint,SET,2)
+ std_u16le=dt; /* Keep type for later */
+
+ /* 2-byte big-endian unsigned integer */
+ H5T_INIT_TYPE(UINTBE,H5T_STD_U16BE_g,COPY,native_uint,SET,2)
+ std_u16be=dt; /* Keep type for later */
+
+ /* 4-byte little-endian unsigned integer */
+ H5T_INIT_TYPE(UINTLE,H5T_STD_U32LE_g,COPY,native_uint,SET,4)
+ std_u32le=dt; /* Keep type for later */
+
+ /* 4-byte big-endian unsigned integer */
+ H5T_INIT_TYPE(UINTBE,H5T_STD_U32BE_g,COPY,native_uint,SET,4)
+ std_u32be=dt; /* Keep type for later */
+
+ /* 8-byte little-endian unsigned integer */
+ H5T_INIT_TYPE(UINTLE,H5T_STD_U64LE_g,COPY,native_uint,SET,8)
+ std_u64le=dt; /* Keep type for later */
+
+ /* 8-byte big-endian unsigned integer */
+ H5T_INIT_TYPE(UINTBE,H5T_STD_U64BE_g,COPY,native_uint,SET,8)
+ std_u64be=dt; /* Keep type for later */
+
- /*
- * Register big-endian 16-bit bitfield now also
+ /*------------------------------------------------------------
+ * Little- & Big-endian bitfields
+ *------------------------------------------------------------
*/
- /* Base off of current datatype */
- dt = H5T_copy(dt,H5T_COPY_TRANSIENT);
- assert(dt);
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->type = H5T_BITFIELD;
+ /* little-endian (order is irrelevant) 8-bit bitfield */
+ H5T_INIT_TYPE(BITFIELD,H5T_STD_B8LE_g,COPY,std_u8le,NOSET,-)
- /* Atomize result */
- if ((H5T_STD_B16BE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
-
- /* 4-byte little-endian unsigned integer */
- if(H5T_STD_U32LE_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_uint,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 4;
- dt->u.atomic.offset = 0;
- dt->u.atomic.prec = 32;
- dt->u.atomic.order = H5T_ORDER_LE;
- dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
- dt->u.atomic.msb_pad = H5T_PAD_ZERO;
- dt->u.atomic.u.i.sign = H5T_SGN_NONE;
-
- /* Atomize result */
- if ((H5T_STD_U32LE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
+ /* big-endian (order is irrelevant) 8-bit bitfield */
+ H5T_INIT_TYPE(BITFIELD,H5T_STD_B8BE_g,COPY,std_u8be,NOSET,-)
- /*
- * Register little-endian 32-bit bitfield now also
- */
- /* Base off of current datatype */
- dt = H5T_copy(dt,H5T_COPY_TRANSIENT);
- assert(dt);
+ /* Little-endian 16-bit bitfield */
+ H5T_INIT_TYPE(BITFIELD,H5T_STD_B16LE_g,COPY,std_u16le,NOSET,-)
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->type = H5T_BITFIELD;
+ /* Big-endian 16-bit bitfield */
+ H5T_INIT_TYPE(BITFIELD,H5T_STD_B16BE_g,COPY,std_u16be,NOSET,-)
- /* Atomize result */
- if ((H5T_STD_B32LE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
+ /* Little-endian 32-bit bitfield */
+ H5T_INIT_TYPE(BITFIELD,H5T_STD_B32LE_g,COPY,std_u32le,NOSET,-)
- /*
- * Register 4-byte little-endian UNIX time_t now also
- */
- /* Base off of current datatype */
- dt = H5T_copy(dt,H5T_COPY_TRANSIENT);
- assert(dt);
+ /* Big-endian 32-bit bitfield */
+ H5T_INIT_TYPE(BITFIELD,H5T_STD_B32BE_g,COPY,std_u32be,NOSET,-)
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->type = H5T_TIME;
+ /* Little-endian 64-bit bitfield */
+ H5T_INIT_TYPE(BITFIELD,H5T_STD_B64LE_g,COPY,std_u64le,NOSET,-)
- /* Atomize result */
- if ((H5T_UNIX_D32LE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
-
- /* 4-byte big-endian unsigned integer */
- if(H5T_STD_U32BE_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_uint,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 4;
- dt->u.atomic.offset = 0;
- dt->u.atomic.prec = 32;
- dt->u.atomic.order = H5T_ORDER_BE;
- dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
- dt->u.atomic.msb_pad = H5T_PAD_ZERO;
- dt->u.atomic.u.i.sign = H5T_SGN_NONE;
-
- /* Atomize result */
- if ((H5T_STD_U32BE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
+ /* Big-endian 64-bit bitfield */
+ H5T_INIT_TYPE(BITFIELD,H5T_STD_B64BE_g,COPY,std_u64be,NOSET,-)
- /*
- * Register big-endian 32-bit bitfield now also
+ /*------------------------------------------------------------
+ * The Unix architecture for dates and times.
+ *------------------------------------------------------------
*/
- /* Base off of current datatype */
- dt = H5T_copy(dt,H5T_COPY_TRANSIENT);
- assert(dt);
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->type = H5T_BITFIELD;
+ /* Little-endian 32-bit UNIX time_t */
+ H5T_INIT_TYPE(TIME,H5T_UNIX_D32LE_g,COPY,std_u32le,NOSET,-)
- /* Atomize result */
- if ((H5T_STD_B32BE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
+ /* Big-endian 32-bit UNIX time_t */
+ H5T_INIT_TYPE(TIME,H5T_UNIX_D32BE_g,COPY,std_u32be,NOSET,-)
- /*
- * Register 4-byte big-endian UNIX time_t now also
- */
- /* Base off of current datatype */
- dt = H5T_copy(dt,H5T_COPY_TRANSIENT);
- assert(dt);
+ /* Little-endian 64-bit UNIX time_t */
+ H5T_INIT_TYPE(TIME,H5T_UNIX_D64LE_g,COPY,std_u64le,NOSET,-)
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->type = H5T_TIME;
+ /* Big-endian 64-bit UNIX time_t */
+ H5T_INIT_TYPE(TIME,H5T_UNIX_D64BE_g,COPY,std_u64be,NOSET,-)
- /* Atomize result */
- if ((H5T_UNIX_D32BE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
-
- /* 8-byte little-endian unsigned integer */
- if(H5T_STD_U64LE_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_uint,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 8;
- dt->u.atomic.offset = 0;
- dt->u.atomic.prec = 64;
- dt->u.atomic.order = H5T_ORDER_LE;
- dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
- dt->u.atomic.msb_pad = H5T_PAD_ZERO;
- dt->u.atomic.u.i.sign = H5T_SGN_NONE;
-
- /* Atomize result */
- if ((H5T_STD_U64LE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- /*
- * Register little-endian 64-bit bitfield now also
+ /* Indicate that the types that are created from here down are allocated
+ * H5FL_ALLOC(), not copied with H5T_copy()
*/
- /* Base off of current datatype */
- dt = H5T_copy(dt,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->type = H5T_BITFIELD;
+ copied_dtype=0;
- /* Atomize result */
- if ((H5T_STD_B64LE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
+ /* Opaque data */
+ H5T_INIT_TYPE(OPAQUE,H5T_NATIVE_OPAQUE_g,ALLOC,-,SET,1)
- /*
- * Register 8-byte little-endian UNIX time_t now also
+ /*------------------------------------------------------------
+ * The `C' architecture
+ *------------------------------------------------------------
*/
- /* Base off of current datatype */
- dt = H5T_copy(dt,H5T_COPY_TRANSIENT);
- assert(dt);
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->type = H5T_TIME;
+ /* One-byte character string */
+ H5T_INIT_TYPE(CSTRING,H5T_C_S1_g,ALLOC,-,SET,1)
- /* Atomize result */
- if ((H5T_UNIX_D64LE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
-
- /* 8-byte big-endian unsigned integer */
- if(H5T_STD_U64BE_g<0) {
- /* Base off of native datatype */
- dt = H5T_copy(native_uint,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->size = 8;
- dt->u.atomic.offset = 0;
- dt->u.atomic.prec = 64;
- dt->u.atomic.order = H5T_ORDER_BE;
- dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
- dt->u.atomic.msb_pad = H5T_PAD_ZERO;
- dt->u.atomic.u.i.sign = H5T_SGN_NONE;
-
- /* Atomize result */
- if ((H5T_STD_U64BE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
-
- /*
- * Register big-endian 64-bit bitfield now also
+ /*------------------------------------------------------------
+ * The `Fortran' architecture
+ *------------------------------------------------------------
*/
- /* Base off of current datatype */
- dt = H5T_copy(dt,H5T_COPY_TRANSIENT);
- assert(dt);
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->type = H5T_BITFIELD;
+ /* One-byte character string */
+ H5T_INIT_TYPE(FORSTRING,H5T_FORTRAN_S1_g,ALLOC,-,SET,1)
- /* Atomize result */
- if ((H5T_STD_B64BE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
-
- /*
- * Register 8-byte big-endian UNIX time_t now also
+ /*------------------------------------------------------------
+ * Pointer types
+ *------------------------------------------------------------
*/
- /* Base off of current datatype */
- dt = H5T_copy(dt,H5T_COPY_TRANSIENT);
- assert(dt);
-
- /* Adjust information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->type = H5T_TIME;
-
- /* Atomize result */
- if ((H5T_UNIX_D64BE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
- } /* end if */
-
-
- /*------------------------------------------------------------
- * Little- & Big-endian bitfields
- *------------------------------------------------------------
- */
-
- /* Moved into the U32LE, U32BE, U64LE & U64BE sections */
-
- /*------------------------------------------------------------
- * The Unix architecture for dates and times.
- *------------------------------------------------------------
- */
-
- /* Moved into the U32LE, U32BE, U64LE & U64BE sections */
-
- /* Indicate that the types that are created from here down are allocated
- * H5FL_ALLOC(), not copied with H5T_copy()
- */
- copied_dtype=0;
-
- /* Opaque data */
- if(H5T_NATIVE_OPAQUE_g<0) {
- if (NULL==(dt = H5FL_CALLOC(H5T_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
-
- /* Set information */
- dt->state = H5T_STATE_IMMUTABLE;
- dt->ent.header = HADDR_UNDEF;
- dt->type = H5T_OPAQUE;
- dt->size = 1;
- dt->u.opaque.tag = H5MM_strdup("");
-
- /* Atomize result */
- if ((H5T_NATIVE_OPAQUE_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize H5T layer");
- } /* end if */
-
- /*------------------------------------------------------------
- * The `C' architecture
- *------------------------------------------------------------
- */
-
- /* One-byte character string */
- if(H5T_C_S1_g<0) {
- if (NULL==(dt = H5FL_CALLOC(H5T_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
-
- dt->state = H5T_STATE_IMMUTABLE;
- dt->ent.header = HADDR_UNDEF;
- dt->type = H5T_STRING;
- dt->size = 1;
- dt->u.atomic.order = H5T_ORDER_NONE;
- dt->u.atomic.offset = 0;
- dt->u.atomic.prec = 8 * dt->size;
- dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
- dt->u.atomic.msb_pad = H5T_PAD_ZERO;
- dt->u.atomic.u.s.cset = H5T_CSET_ASCII;
- dt->u.atomic.u.s.pad = H5T_STR_NULLTERM;
-
- if ((H5T_C_S1_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize H5T layer");
- } /* end if */
-
- /*------------------------------------------------------------
- * The `Fortran' architecture
- *------------------------------------------------------------
- */
- /* One-byte character string */
- if(H5T_FORTRAN_S1_g<0) {
- if (NULL==(dt = H5FL_CALLOC(H5T_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
-
- dt->state = H5T_STATE_IMMUTABLE;
- dt->ent.header = HADDR_UNDEF;
- dt->type = H5T_STRING;
- dt->size = 1;
- dt->u.atomic.order = H5T_ORDER_NONE;
- dt->u.atomic.offset = 0;
- dt->u.atomic.prec = 8 * dt->size;
- dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
- dt->u.atomic.msb_pad = H5T_PAD_ZERO;
- dt->u.atomic.u.s.cset = H5T_CSET_ASCII;
- dt->u.atomic.u.s.pad = H5T_STR_SPACEPAD;
-
- if ((H5T_FORTRAN_S1_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize H5T layer");
- } /* end if */
-
- /*------------------------------------------------------------
- * Pointer types
- *------------------------------------------------------------
- */
-
- /* Object pointer (i.e. object header address in file) */
- if(H5T_STD_REF_OBJ_g<0) {
- if (NULL==(dt = H5FL_CALLOC(H5T_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
-
- dt->state = H5T_STATE_IMMUTABLE;
- dt->ent.header = HADDR_UNDEF;
- dt->type = H5T_REFERENCE;
- dt->size = H5R_OBJ_REF_BUF_SIZE;
- dt->u.atomic.order = H5T_ORDER_NONE;
- dt->u.atomic.offset = 0;
- dt->u.atomic.prec = 8 * dt->size;
- dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
- dt->u.atomic.msb_pad = H5T_PAD_ZERO;
- dt->u.atomic.u.r.rtype = H5R_OBJECT;
-
- if ((H5T_STD_REF_OBJ_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize H5T layer");
- } /* end if */
-
- /* Dataset Region pointer (i.e. selection inside a dataset) */
- if(H5T_STD_REF_DSETREG_g<0) {
- if (NULL==(dt = H5FL_CALLOC(H5T_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
-
- dt->state = H5T_STATE_IMMUTABLE;
- dt->ent.header = HADDR_UNDEF;
- dt->type = H5T_REFERENCE;
- dt->size = H5R_DSET_REG_REF_BUF_SIZE;
- dt->u.atomic.order = H5T_ORDER_NONE;
- dt->u.atomic.offset = 0;
- dt->u.atomic.prec = 8 * dt->size;
- dt->u.atomic.lsb_pad = H5T_PAD_ZERO;
- dt->u.atomic.msb_pad = H5T_PAD_ZERO;
- dt->u.atomic.u.r.rtype = H5R_DATASET_REGION;
-
- if ((H5T_STD_REF_DSETREG_g = H5I_register(H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize H5T layer");
+ /* Object pointer (i.e. object header address in file) */
+ H5T_INIT_TYPE(OBJREF,H5T_STD_REF_OBJ_g,ALLOC,-,SET,H5R_OBJ_REF_BUF_SIZE)
+
+ /* Dataset Region pointer (i.e. selection inside a dataset) */
+ H5T_INIT_TYPE(REGREF,H5T_STD_REF_DSETREG_g,ALLOC,-,SET,H5R_DSET_REG_REF_BUF_SIZE)
} /* end if */
/*
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index e34fac6..cab5553 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -63,14 +63,19 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
/*
* These macros are for the bodies of functions that convert buffers of one
- * integer type to another using hardware. They all start with `H5T_CONV_'
- * and end with two letters that represent the source and destination types,
- * respectively. The letters `s' and `S' refer to signed values while the
- * letters `u' and `U' refer to unsigned values. The letter which is
- * capitalized indicates that the corresponding type (source or destination)
- * is at least as large as the other type. Certain conversions may
- * experience overflow conditions which arise when the source value has a
- * magnitude that cannot be represented by the destination type.
+ * atomic type to another using hardware.
+ *
+ * They all start with `H5T_CONV_' and end with two letters that represent the
+ * source and destination types, respectively. The letters `s' and `S' refer to
+ * signed integers while the letters `u' and `U' refer to unsigned integers, and
+ * the letters `f' and `F' refer to floating-point values.
+ *
+ * The letter which is capitalized indicates that the corresponding type
+ * (source or destination) is at least as large as the other type.
+ *
+ * Certain conversions may experience overflow conditions which arise when the
+ * source value has a magnitude that cannot be represented by the destination
+ * type.
*
* Suffix Description
* ------ -----------
@@ -116,14 +121,22 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
* occurs when the source magnitude is too large for the
* destination.
*
+ * fF: Floating-point values to floating-point values where the
+ * destination is at least as wide as the source. This case
+ * cannot generate overflows.
+ *
+ * Ff: Floating-point values to floating-point values the source is at
+ * least as large as the destination. Overflows can occur when
+ * the destination is narrower than the source.
+ *
* The macros take a subset of these arguments in the order listed here:
*
* CDATA: A pointer to the H5T_cdata_t structure that was passed to the
* conversion function.
*
- * S_ID: The hid_t value for the source data type.
+ * STYPE: The hid_t value for the source data type.
*
- * D_ID: The hid_t value for the destination data type.
+ * DTYPE: The hid_t value for the destination data type.
*
* BUF: A pointer to the conversion buffer.
*
@@ -142,169 +155,163 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
* D_MAX: The maximum possible destination value. Source values which
* are larger than D_MAX generate overflows.
*
+ * The macros are implemented with a generic programming technique, similar
+ * to templates in C++. The macro which defines the "core" part of the
+ * conversion (which actually moves the data from the source to the destination)
+ * is invoked inside the H5T_CONV "template" macro by "gluing" it together,
+ * which allows the core conversion macro to be invoked as necessary.
+ *
+ * The generic "core" macros are: (others are specific to particular conversion)
+ *
+ * Suffix Description
+ * ------ -----------
+ * xX: Generic Conversion where the destination is at least as
+ * wide as the source. This case cannot generate overflows.
+ *
+ * Xx: Generic signed conversion where the source is at least as large
+ * as the destination. Overflows can occur when the destination is
+ * narrower than the source.
+ *
+ * SU: Generic signed to unsigned conversion where the source is
+ * the same size or smaller than the destination. Overflow occurs
+ * when the source value is negative.
+ *
+ * Ux: Generic conversion for the `Us', `Uu' & `us' cases
+ * Overflow occurs when the source magnitude is too large for the
+ * destination.
+ *
*/
-#define H5T_CONV_sS(S_ALIGN,D_ALIGN,ST,DT) { \
+#define H5T_CONV_xX_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
+ *((DT*)D) = (DT)(*((ST*)S)); \
+}
+
+#define H5T_CONV_Xx_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
+ if (*((ST*)S) > (DT)(D_MAX)) { \
+ if (!H5T_overflow_g || (H5T_overflow_g)(src_id, dst_id, S, D)<0) \
+ *((DT*)D) = (D_MAX); \
+ } else if (*((ST*)S) < (D_MIN)) { \
+ if (!H5T_overflow_g || (H5T_overflow_g)(src_id, dst_id, S, D)<0) \
+ *((DT*)D) = (D_MIN); \
+ } else \
+ *((DT*)D) = (DT)(*((ST*)S)); \
+}
+
+#define H5T_CONV_SU_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
+ if (*((ST*)S)<0) { \
+ if (!H5T_overflow_g || (H5T_overflow_g)(src_id, dst_id, S, D)<0) \
+ *((DT*)D) = 0; \
+ } else \
+ *((DT*)D) = (DT)(*((ST*)S)); \
+}
+
+#define H5T_CONV_Ux_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
+ if (*((ST*)S) > (D_MAX)) { \
+ if (!H5T_overflow_g || (H5T_overflow_g)(src_id, dst_id, S, D)<0) \
+ *((DT*)D) = (D_MAX); \
+ } else \
+ *((DT*)D) = (DT)(*((ST*)S)); \
+}
+
+#define H5T_CONV_sS(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
assert(sizeof(ST)<=sizeof(DT)); \
- CI_BEGIN(S_ALIGN, D_ALIGN, ST, DT, nelmts-1) { \
- *((DT*)d) = (DT)(*((ST*)s)); \
- } CI_END; \
+ H5T_CONV(H5T_CONV_xX, long_long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, nelmts-1) \
}
-#define H5T_CONV_sU(STYPE,DTYPE,ST,DT) { \
+#define H5T_CONV_sU(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
assert(sizeof(ST)<=sizeof(DT)); \
- CI_BEGIN(STYPE, DTYPE, ST, DT, nelmts-1) { \
- if (*((ST*)s)<0) { \
- if (!H5T_overflow_g || \
- (H5T_overflow_g)(src_id, dst_id, s, d)<0) { \
- *((DT*)d) = 0; \
- } \
- } else { \
- *((DT*)d) = (DT)(*((ST*)s)); \
- } \
- } CI_END; \
+ H5T_CONV(H5T_CONV_SU, long_long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, nelmts-1) \
+}
+
+#define H5T_CONV_uS_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
+ if (sizeof(ST)==sizeof(DT) && *((ST*)S) > (D_MAX)) { \
+ if (!H5T_overflow_g || (H5T_overflow_g)(src_id, dst_id, S, D)<0) \
+ *((DT*)D) = (D_MAX); \
+ } else \
+ *((DT*)D) = (DT)(*((ST*)S)); \
}
-#define H5T_CONV_uS(STYPE,DTYPE,ST,DT,D_MAX) { \
+#define H5T_CONV_uS(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
assert(sizeof(ST)<=sizeof(DT)); \
- CI_BEGIN(STYPE, DTYPE, ST, DT, nelmts-1) { \
- if (*((ST*)s) > (D_MAX)) { \
- if (!H5T_overflow_g || \
- (H5T_overflow_g)(src_id, dst_id, s, d)<0) { \
- *((DT*)d) = (D_MAX); \
- } \
- } else { \
- *((DT*)d) = (DT)(*((ST*)s)); \
- } \
- } CI_END; \
+ H5T_CONV(H5T_CONV_uS, long_long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, nelmts-1) \
}
-#define H5T_CONV_uU(STYPE,DTYPE,ST,DT) { \
+#define H5T_CONV_uU(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
assert(sizeof(ST)<=sizeof(DT)); \
- CI_BEGIN(STYPE, DTYPE, ST, DT, nelmts-1) { \
- *((DT*)d) = (DT)(*((ST*)s)); \
- } CI_END; \
+ H5T_CONV(H5T_CONV_xX, long_long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, nelmts-1) \
}
#define H5T_CONV_Ss(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
assert(sizeof(ST)>=sizeof(DT)); \
- CI_BEGIN(STYPE, DTYPE, ST, DT, 0) { \
- if (*((ST*)s) > (DT)(D_MAX)) { \
- if (!H5T_overflow_g || \
- (H5T_overflow_g)(src_id, dst_id, s, d)<0) { \
- *((DT*)d) = (D_MAX); \
- } \
- } else if (*((ST*)s) < (D_MIN)) { \
- if (!H5T_overflow_g || \
- (H5T_overflow_g)(src_id, dst_id, s, d)<0) { \
- *((DT*)d) = (D_MIN); \
- } \
- } else { \
- *((DT*)d) = (DT)(*((ST*)s)); \
- } \
- } CI_END; \
+ H5T_CONV(H5T_CONV_Xx, long_long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, 0) \
}
-#define H5T_CONV_Su(STYPE,DTYPE,ST,DT,D_MAX) { \
+#define H5T_CONV_Su_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
+ if (*((ST*)S) < 0) { \
+ if (!H5T_overflow_g || (H5T_overflow_g)(src_id, dst_id, S, D)<0) \
+ *((DT*)D) = 0; \
+ } else if (sizeof(ST)>sizeof(DT) && *((ST*)S)>(ST)(D_MAX)) { \
+ /*sign vs. unsign ok in previous line*/ \
+ if (!H5T_overflow_g || (H5T_overflow_g)(src_id, dst_id, S, D)<0) \
+ *((DT*)D) = (D_MAX); \
+ } else \
+ *((DT*)D) = (DT)(*((ST*)S)); \
+}
+
+#define H5T_CONV_Su(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
assert(sizeof(ST)>=sizeof(DT)); \
- CI_BEGIN(STYPE, DTYPE, ST, DT, 0) { \
- if (*((ST*)s) < 0) { \
- if (!H5T_overflow_g || \
- (H5T_overflow_g)(src_id, dst_id, s, d)<0) { \
- *((DT*)d) = 0; \
- } \
- } else if (sizeof(ST)>sizeof(DT) && *((ST*)s)>(ST)(D_MAX)) { \
- /*sign vs. unsign ok in previous line*/ \
- if (!H5T_overflow_g || \
- (H5T_overflow_g)(src_id, dst_id, s, d)<0) { \
- *((DT*)d) = (D_MAX); \
- } \
- } else { \
- *((DT*)d) = (DT)(*((ST*)s)); \
- } \
- } CI_END; \
+ H5T_CONV(H5T_CONV_Su, long_long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, 0) \
}
-#define H5T_CONV_Us(STYPE,DTYPE,ST,DT,D_MAX) { \
+#define H5T_CONV_Us(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
assert(sizeof(ST)>=sizeof(DT)); \
- CI_BEGIN(STYPE, DTYPE, ST, DT, 0) { \
- if (*((ST*)s) > (D_MAX)) { \
- if (!H5T_overflow_g || \
- (H5T_overflow_g)(src_id, dst_id, s, d)<0) { \
- *((DT*)d) = (D_MAX); \
- } \
- } else { \
- *((DT*)d) = (DT)(*((ST*)s)); \
- } \
- } CI_END; \
+ H5T_CONV(H5T_CONV_Ux, long_long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, 0) \
}
-#define H5T_CONV_Uu(STYPE,DTYPE,ST,DT,D_MAX) { \
+#define H5T_CONV_Uu(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
assert(sizeof(ST)>=sizeof(DT)); \
- CI_BEGIN(STYPE, DTYPE, ST, DT, 0) { \
- if (*((ST*)s) > (D_MAX)) { \
- if (!H5T_overflow_g || \
- (H5T_overflow_g)(src_id, dst_id, s, d)<0) { \
- *((DT*)d) = (D_MAX); \
- } \
- } else { \
- *((DT*)d) = (DT)(*((ST*)s)); \
- } \
- } CI_END; \
+ H5T_CONV(H5T_CONV_Ux, long_long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, 0) \
}
-#define H5T_CONV_su(STYPE,DTYPE,ST,DT) { \
+#define H5T_CONV_su(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
assert(sizeof(ST)==sizeof(DT)); \
- CI_BEGIN(STYPE, DTYPE, ST, DT, 0) { \
- if (*((ST*)s) < 0) { \
- if (!H5T_overflow_g || \
- (H5T_overflow_g)(src_id, dst_id, s, d)<0) { \
- *((DT*)d) = 0; \
- } \
- } else { \
- *((DT*)d) = (DT)(*((ST*)s)); \
- } \
- } CI_END; \
+ H5T_CONV(H5T_CONV_SU, long_long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, 0) \
}
-#define H5T_CONV_us(STYPE,DTYPE,ST,DT,D_MAX) { \
+#define H5T_CONV_us(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
assert(sizeof(ST)==sizeof(DT)); \
- CI_BEGIN(STYPE, DTYPE, ST, DT, 0) { \
- if (*((ST*)s) > (D_MAX)) { \
- if (!H5T_overflow_g || \
- (H5T_overflow_g)(src_id, dst_id, s, d)<0) { \
- *((DT*)d) = (D_MAX); \
- } \
- } else { \
- *((DT*)d) = (DT)(*((ST*)s)); \
- } \
- } CI_END; \
+ H5T_CONV(H5T_CONV_Ux, long_long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, 0) \
}
-/* The first part of every integer hardware conversion macro */
-#define CI_BEGIN(STYPE,DTYPE,ST,DT,STRT) { \
+#define H5T_CONV_fF(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
+ assert(sizeof(ST)<=sizeof(DT)); \
+ H5T_CONV(H5T_CONV_xX, double, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, nelmts-1) \
+}
+
+#define H5T_CONV_Ff(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
+ assert(sizeof(ST)>=sizeof(DT)); \
+ H5T_CONV(H5T_CONV_Xx, double, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, 0) \
+}
+
+/* The main part of every integer hardware conversion macro */
+#define H5T_CONV(GUTS,ATYPE,STYPE,DTYPE,ST,DT,D_MIN,D_MAX,STRT) { \
hsize_t elmtno; /*element number */ \
- void *src, *s; /*source buffer */ \
- void *dst, *d; /*destination buffer */ \
+ uint8_t *src, *s; /*source buffer */ \
+ uint8_t *dst, *d; /*destination buffer */ \
H5T_t *st, *dt; /*data type descriptors */ \
- long_long aligned; /*largest integer type, aligned */ \
+ ATYPE aligned; /*aligned type */ \
hbool_t s_mv, d_mv; /*move data to align it? */ \
- size_t dt_size=sizeof(DT); /*needed by CI_END macro */ \
size_t s_stride, d_stride; /*src and dst strides */ \
- int direction; /*1=left-to-right, -1=rt-to-lt */ \
\
switch (cdata->command) { \
case H5T_CONV_INIT: \
/* Sanity check and initialize statistics */ \
cdata->need_bkg = H5T_BKG_NO; \
- if (NULL==(st=H5I_object(src_id)) || \
- NULL==(dt=H5I_object(dst_id))) { \
+ if (NULL==(st=H5I_object(src_id)) || NULL==(dt=H5I_object(dst_id))) \
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, \
- "unable to dereference data type object ID"); \
- } \
- if (st->size!=sizeof(ST) || dt->size!=sizeof(DT)) { \
+ "unable to dereference datatype object ID") \
+ if (st->size!=sizeof(ST) || dt->size!=sizeof(DT)) \
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, \
- "disagreement about data type size"); \
- } \
+ "disagreement about datatype size") \
CI_ALLOC_PRIV \
break; \
\
@@ -318,19 +325,17 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
/* Initialize pointers */ \
if (buf_stride) { \
s_stride = d_stride = buf_stride; \
- src = dst = buf; \
- direction = 1; \
- } else if (STRT) { \
- s_stride = sizeof(ST); \
- d_stride = sizeof(DT); \
- src = (uint8_t*)buf+(STRT)*s_stride; \
- dst = (uint8_t*)buf+(STRT)*d_stride; \
- direction = -1; \
} else { \
- s_stride = sizeof(ST); \
- d_stride = sizeof(DT); \
+ s_stride = sizeof(ST); \
+ d_stride = sizeof(DT); \
+ } \
+ if (STRT) { \
+ src = (uint8_t*)buf+(STRT)*s_stride; \
+ dst = (uint8_t*)buf+(STRT)*d_stride; \
+ s_stride = -s_stride; \
+ d_stride = -d_stride; \
+ } else { \
src = dst = buf; \
- direction = 1; \
} \
\
/* Is alignment required for source or dest? */ \
@@ -342,31 +347,24 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
((size_t)buf%H5T_NATIVE_##DTYPE##_ALIGN_g || \
/* Cray */ ((size_t)((DT*)buf)!=(size_t)buf) || \
d_stride%H5T_NATIVE_##DTYPE##_ALIGN_g); \
- CI_INC_SRC(s_mv) \
- CI_INC_DST(d_mv) \
- \
- for (elmtno=0; elmtno<nelmts; elmtno++) { \
- /* Alignment */ \
- if (s_mv) { \
- HDmemcpy(&aligned, src, sizeof(ST)); \
- s = (uint8_t*)&aligned; \
- } else { \
- s = src; \
- } \
- if (d_mv) { \
- d = (uint8_t*)&aligned; \
- } else { \
- d = dst; \
- } \
- /* ... user-defined stuff here -- the conversion ... */
-#define CI_END \
- /* Copy destination to final location */ \
- if (d_mv) HDmemcpy(dst, &aligned, dt_size); \
+ CI_INC_SRC(s_mv) \
+ CI_INC_DST(d_mv) \
\
- /* Advance pointers */ \
- src = (char *)src + direction * s_stride; \
- dst = (char *)dst + direction * d_stride; \
- } \
+ if (s_mv && d_mv) { \
+ /* Alignment is required for both source and dest */ \
+ s = (uint8_t*)&aligned; \
+ H5T_CONV_LOOP(PRE_SALIGN,PRE_DALIGN,POST_SALIGN,POST_DALIGN,GUTS,s,d,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) \
+ } else if(s_mv) { \
+ /* Alignment is required only for source */ \
+ s = (uint8_t*)&aligned; \
+ H5T_CONV_LOOP(PRE_SALIGN,PRE_DNOALIGN,POST_SALIGN,POST_DNOALIGN,GUTS,s,dst,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) \
+ } else if(d_mv) { \
+ /* Alignment is required only for destination */ \
+ H5T_CONV_LOOP(PRE_SNOALIGN,PRE_DALIGN,POST_SNOALIGN,POST_DALIGN,GUTS,src,d,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) \
+ } else { \
+ /* Alignment is not required for both source and destination */ \
+ H5T_CONV_LOOP(PRE_SNOALIGN,PRE_DNOALIGN,POST_SNOALIGN,POST_DNOALIGN,GUTS,src,dst,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) \
+ } \
break; \
\
default: \
@@ -375,6 +373,65 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
} \
}
+/* Macro defining action on source data which needs to be aligned (before main action) */
+#define H5T_CONV_LOOP_PRE_SALIGN(ST) { \
+ HDmemcpy(&aligned, src, sizeof(ST)); \
+}
+
+/* Macro defining action on source data which doesn't need to be aligned (before main action) */
+#define H5T_CONV_LOOP_PRE_SNOALIGN(ST) { \
+}
+
+/* Macro defining action on destination data which needs to be aligned (before main action) */
+#define H5T_CONV_LOOP_PRE_DALIGN(DT) { \
+ d = (uint8_t*)&aligned; \
+}
+
+/* Macro defining action on destination data which doesn't need to be aligned (before main action) */
+#define H5T_CONV_LOOP_PRE_DNOALIGN(DT) { \
+}
+
+/* Macro defining action on source data which needs to be aligned (after main action) */
+#define H5T_CONV_LOOP_POST_SALIGN(ST) { \
+}
+
+/* Macro defining action on source data which doesn't need to be aligned (after main action) */
+#define H5T_CONV_LOOP_POST_SNOALIGN(ST) { \
+}
+
+/* Macro defining action on destination data which needs to be aligned (after main action) */
+#define H5T_CONV_LOOP_POST_DALIGN(DT) { \
+ HDmemcpy(dst, &aligned, sizeof(DT)); \
+}
+
+/* Macro defining action on destination data which doesn't need to be aligned (after main action) */
+#define H5T_CONV_LOOP_POST_DNOALIGN(DT) { \
+}
+
+/* The inner loop of the type conversion macro */
+#define H5T_CONV_LOOP(PRE_SALIGN_GUTS,PRE_DALIGN_GUTS,POST_SALIGN_GUTS,POST_DALIGN_GUTS,GUTS,S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) \
+ for (elmtno=0; elmtno<nelmts; elmtno++) { \
+ /* Handle source pre-alignment */ \
+ H5_GLUE(H5T_CONV_LOOP_,PRE_SALIGN_GUTS)(ST) \
+ \
+ /* Handle destination pre-alignment */ \
+ H5_GLUE(H5T_CONV_LOOP_,PRE_DALIGN_GUTS)(DT) \
+ \
+ /* ... user-defined stuff here -- the conversion ... */ \
+ H5_GLUE(GUTS,_CORE)(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) \
+ \
+ /* Handle source post-alignment */ \
+ H5_GLUE(H5T_CONV_LOOP_,POST_SALIGN_GUTS)(ST) \
+ \
+ /* Handle destination post-alignment */ \
+ H5_GLUE(H5T_CONV_LOOP_,POST_DALIGN_GUTS)(DT) \
+ \
+ /* Advance pointers */ \
+ src += s_stride; \
+ dst += d_stride; \
+ }
+
+
#ifdef H5T_DEBUG
/* Print alignment statistics */
@@ -3537,7 +3594,7 @@ H5T_conv_schar_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_schar_uchar, FAIL);
- H5T_CONV_su(SCHAR, UCHAR, signed char, unsigned char);
+ H5T_CONV_su(SCHAR, UCHAR, signed char, unsigned char, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -3570,7 +3627,7 @@ H5T_conv_uchar_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_uchar_schar, FAIL);
- H5T_CONV_us(UCHAR, SCHAR, unsigned char, signed char, SCHAR_MAX);
+ H5T_CONV_us(UCHAR, SCHAR, unsigned char, signed char, -, SCHAR_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -3603,7 +3660,7 @@ H5T_conv_schar_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_schar_short, FAIL);
- H5T_CONV_sS(SCHAR, SHORT, signed char, short);
+ H5T_CONV_sS(SCHAR, SHORT, signed char, short, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -3636,7 +3693,7 @@ H5T_conv_schar_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_schar_ushort, FAIL);
- H5T_CONV_sU(SCHAR, USHORT, signed char, unsigned short);
+ H5T_CONV_sU(SCHAR, USHORT, signed char, unsigned short, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -3669,7 +3726,7 @@ H5T_conv_uchar_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_uchar_short, FAIL);
- H5T_CONV_uS(UCHAR, SHORT, unsigned char, short, SHRT_MAX);
+ H5T_CONV_uS(UCHAR, SHORT, unsigned char, short, -, SHRT_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -3702,7 +3759,7 @@ H5T_conv_uchar_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_uchar_ushort, FAIL);
- H5T_CONV_uU(UCHAR, USHORT, unsigned char, unsigned short);
+ H5T_CONV_uU(UCHAR, USHORT, unsigned char, unsigned short, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -3734,7 +3791,7 @@ H5T_conv_schar_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_schar_int, FAIL);
- H5T_CONV_sS(SCHAR, INT, signed char, int);
+ H5T_CONV_sS(SCHAR, INT, signed char, int, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -3766,7 +3823,7 @@ H5T_conv_schar_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_schar_uint, FAIL);
- H5T_CONV_sU(SCHAR, UINT, signed char, unsigned);
+ H5T_CONV_sU(SCHAR, UINT, signed char, unsigned, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -3798,7 +3855,7 @@ H5T_conv_uchar_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_uchar_int, FAIL);
- H5T_CONV_uS(UCHAR, INT, unsigned char, int, INT_MAX);
+ H5T_CONV_uS(UCHAR, INT, unsigned char, int, -, INT_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -3830,7 +3887,7 @@ H5T_conv_uchar_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_uchar_uint, FAIL);
- H5T_CONV_uU(UCHAR, UINT, unsigned char, unsigned);
+ H5T_CONV_uU(UCHAR, UINT, unsigned char, unsigned, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -3862,7 +3919,7 @@ H5T_conv_schar_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_schar_long, FAIL);
- H5T_CONV_sS(SCHAR, LONG, signed char, long);
+ H5T_CONV_sS(SCHAR, LONG, signed char, long, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -3895,7 +3952,7 @@ H5T_conv_schar_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_schar_ulong, FAIL);
- H5T_CONV_sU(SCHAR, ULONG, signed char, unsigned long);
+ H5T_CONV_sU(SCHAR, ULONG, signed char, unsigned long, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -3927,7 +3984,7 @@ H5T_conv_uchar_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_uchar_long, FAIL);
- H5T_CONV_uS(UCHAR, LONG, unsigned char, long, LONG_MAX);
+ H5T_CONV_uS(UCHAR, LONG, unsigned char, long, -, LONG_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -3960,7 +4017,7 @@ H5T_conv_uchar_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_uchar_ulong, FAIL);
- H5T_CONV_uU(UCHAR, ULONG, unsigned char, unsigned long);
+ H5T_CONV_uU(UCHAR, ULONG, unsigned char, unsigned long, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -3993,7 +4050,7 @@ H5T_conv_schar_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_schar_llong, FAIL);
- H5T_CONV_sS(SCHAR, LLONG, signed char, long_long);
+ H5T_CONV_sS(SCHAR, LLONG, signed char, long_long, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4026,7 +4083,7 @@ H5T_conv_schar_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_schar_ullong, FAIL);
- H5T_CONV_sU(SCHAR, ULLONG, signed char, unsigned long_long);
+ H5T_CONV_sU(SCHAR, ULLONG, signed char, unsigned long_long, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4059,7 +4116,7 @@ H5T_conv_uchar_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_uchar_llong, FAIL);
- H5T_CONV_uS(UCHAR, LLONG, unsigned char, long_long, LLONG_MAX);
+ H5T_CONV_uS(UCHAR, LLONG, unsigned char, long_long, -, LLONG_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4092,7 +4149,7 @@ H5T_conv_uchar_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_uchar_ullong, FAIL);
- H5T_CONV_uU(UCHAR, ULLONG, unsigned char, unsigned long_long);
+ H5T_CONV_uU(UCHAR, ULLONG, unsigned char, unsigned long_long, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4158,7 +4215,7 @@ H5T_conv_short_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_short_uchar, FAIL);
- H5T_CONV_Su(SHORT, UCHAR, short, unsigned char, UCHAR_MAX);
+ H5T_CONV_Su(SHORT, UCHAR, short, unsigned char, -, UCHAR_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4191,7 +4248,7 @@ H5T_conv_ushort_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_ushort_schar, FAIL);
- H5T_CONV_Us(USHORT, SCHAR, unsigned short, signed char, SCHAR_MAX);
+ H5T_CONV_Us(USHORT, SCHAR, unsigned short, signed char, -, SCHAR_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4224,7 +4281,7 @@ H5T_conv_ushort_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_ushort_uchar, FAIL);
- H5T_CONV_Uu(USHORT, UCHAR, unsigned short, unsigned char, UCHAR_MAX);
+ H5T_CONV_Uu(USHORT, UCHAR, unsigned short, unsigned char, -, UCHAR_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4257,7 +4314,7 @@ H5T_conv_short_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_short_ushort, FAIL);
- H5T_CONV_su(SHORT, USHORT, short, unsigned short);
+ H5T_CONV_su(SHORT, USHORT, short, unsigned short, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4290,7 +4347,7 @@ H5T_conv_ushort_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_ushort_short, FAIL);
- H5T_CONV_us(USHORT, SHORT, unsigned short, short, SHRT_MAX);
+ H5T_CONV_us(USHORT, SHORT, unsigned short, short, -, SHRT_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4323,7 +4380,7 @@ H5T_conv_short_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_short_int, FAIL);
- H5T_CONV_sS(SHORT, INT, short, int);
+ H5T_CONV_sS(SHORT, INT, short, int, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4356,7 +4413,7 @@ H5T_conv_short_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_short_uint, FAIL);
- H5T_CONV_sU(SHORT, UINT, short, unsigned);
+ H5T_CONV_sU(SHORT, UINT, short, unsigned, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4389,7 +4446,7 @@ H5T_conv_ushort_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_ushort_int, FAIL);
- H5T_CONV_uS(USHORT, INT, unsigned short, int, INT_MAX);
+ H5T_CONV_uS(USHORT, INT, unsigned short, int, -, INT_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4422,7 +4479,7 @@ H5T_conv_ushort_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_ushort_uint, FAIL);
- H5T_CONV_uU(USHORT, UINT, unsigned short, unsigned);
+ H5T_CONV_uU(USHORT, UINT, unsigned short, unsigned, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4455,7 +4512,7 @@ H5T_conv_short_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_short_long, FAIL);
- H5T_CONV_sS(SHORT, LONG, short, long);
+ H5T_CONV_sS(SHORT, LONG, short, long, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4488,7 +4545,7 @@ H5T_conv_short_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_short_ulong, FAIL);
- H5T_CONV_sU(SHORT, ULONG, short, unsigned long);
+ H5T_CONV_sU(SHORT, ULONG, short, unsigned long, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4521,7 +4578,7 @@ H5T_conv_ushort_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_ushort_long, FAIL);
- H5T_CONV_uS(USHORT, LONG, unsigned short, long, LONG_MAX);
+ H5T_CONV_uS(USHORT, LONG, unsigned short, long, -, LONG_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4554,7 +4611,7 @@ H5T_conv_ushort_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_ushort_ulong, FAIL);
- H5T_CONV_uU(USHORT, ULONG, unsigned short, unsigned long);
+ H5T_CONV_uU(USHORT, ULONG, unsigned short, unsigned long, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4587,7 +4644,7 @@ H5T_conv_short_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_short_llong, FAIL);
- H5T_CONV_sS(SHORT, LLONG, short, long_long);
+ H5T_CONV_sS(SHORT, LLONG, short, long_long, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4620,7 +4677,7 @@ H5T_conv_short_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_short_ullong, FAIL);
- H5T_CONV_sU(SHORT, ULLONG, short, unsigned long_long);
+ H5T_CONV_sU(SHORT, ULLONG, short, unsigned long_long, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4653,7 +4710,7 @@ H5T_conv_ushort_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_ushort_llong, FAIL);
- H5T_CONV_uS(USHORT, LLONG, unsigned short, long_long, LLONG_MAX);
+ H5T_CONV_uS(USHORT, LLONG, unsigned short, long_long, -, LLONG_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4686,7 +4743,7 @@ H5T_conv_ushort_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_ushort_ullong, FAIL);
- H5T_CONV_uU(USHORT, ULLONG, unsigned short, unsigned long_long);
+ H5T_CONV_uU(USHORT, ULLONG, unsigned short, unsigned long_long, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4752,7 +4809,7 @@ H5T_conv_int_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_int_uchar, FAIL);
- H5T_CONV_Su(INT, UCHAR, int, unsigned char, UCHAR_MAX);
+ H5T_CONV_Su(INT, UCHAR, int, unsigned char, -, UCHAR_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4785,7 +4842,7 @@ H5T_conv_uint_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_uint_schar, FAIL);
- H5T_CONV_Us(UINT, SCHAR, unsigned, signed char, SCHAR_MAX);
+ H5T_CONV_Us(UINT, SCHAR, unsigned, signed char, -, SCHAR_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4818,7 +4875,7 @@ H5T_conv_uint_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_uint_uchar, FAIL);
- H5T_CONV_Uu(UINT, UCHAR, unsigned, unsigned char, UCHAR_MAX);
+ H5T_CONV_Uu(UINT, UCHAR, unsigned, unsigned char, -, UCHAR_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4884,7 +4941,7 @@ H5T_conv_int_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_int_ushort, FAIL);
- H5T_CONV_Su(INT, USHORT, int, unsigned short, USHRT_MAX);
+ H5T_CONV_Su(INT, USHORT, int, unsigned short, -, USHRT_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4917,7 +4974,7 @@ H5T_conv_uint_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_uint_short, FAIL);
- H5T_CONV_Us(UINT, SHORT, unsigned, short, SHRT_MAX);
+ H5T_CONV_Us(UINT, SHORT, unsigned, short, -, SHRT_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4950,7 +5007,7 @@ H5T_conv_uint_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_uint_ushort, FAIL);
- H5T_CONV_Uu(UINT, USHORT, unsigned, unsigned short, USHRT_MAX);
+ H5T_CONV_Uu(UINT, USHORT, unsigned, unsigned short, -, USHRT_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -4982,7 +5039,7 @@ H5T_conv_int_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_int_uint, FAIL);
- H5T_CONV_su(INT, UINT, int, unsigned);
+ H5T_CONV_su(INT, UINT, int, unsigned, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -5014,7 +5071,7 @@ H5T_conv_uint_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_uint_int, FAIL);
- H5T_CONV_us(UINT, INT, unsigned, int, INT_MAX);
+ H5T_CONV_us(UINT, INT, unsigned, int, -, INT_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -5046,7 +5103,7 @@ H5T_conv_int_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_int_long, FAIL);
- H5T_CONV_sS(INT, LONG, int, long);
+ H5T_CONV_sS(INT, LONG, int, long, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -5078,7 +5135,7 @@ H5T_conv_int_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_int_ulong, FAIL);
- H5T_CONV_sU(INT, LONG, int, unsigned long);
+ H5T_CONV_sU(INT, LONG, int, unsigned long, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -5110,7 +5167,7 @@ H5T_conv_uint_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_uint_long, FAIL);
- H5T_CONV_uS(UINT, LONG, unsigned, long, LONG_MAX);
+ H5T_CONV_uS(UINT, LONG, unsigned, long, -, LONG_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -5142,7 +5199,7 @@ H5T_conv_uint_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_uint_ulong, FAIL);
- H5T_CONV_uU(UINT, ULONG, unsigned, unsigned long);
+ H5T_CONV_uU(UINT, ULONG, unsigned, unsigned long, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -5174,7 +5231,7 @@ H5T_conv_int_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_int_llong, FAIL);
- H5T_CONV_sS(INT, LLONG, int, long_long);
+ H5T_CONV_sS(INT, LLONG, int, long_long, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -5206,7 +5263,7 @@ H5T_conv_int_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_int_ullong, FAIL);
- H5T_CONV_sU(INT, ULLONG, int, unsigned long_long);
+ H5T_CONV_sU(INT, ULLONG, int, unsigned long_long, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -5238,7 +5295,7 @@ H5T_conv_uint_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_uint_llong, FAIL);
- H5T_CONV_uS(UINT, LLONG, unsigned, long_long, LLONG_MAX);
+ H5T_CONV_uS(UINT, LLONG, unsigned, long_long, -, LLONG_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -5271,7 +5328,7 @@ H5T_conv_uint_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_uint_ullong, FAIL);
- H5T_CONV_uU(UINT, ULLONG, unsigned, unsigned long_long);
+ H5T_CONV_uU(UINT, ULLONG, unsigned, unsigned long_long, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -5335,7 +5392,7 @@ H5T_conv_long_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_long_uchar, FAIL);
- H5T_CONV_Su(LONG, UCHAR, long, unsigned char, UCHAR_MAX);
+ H5T_CONV_Su(LONG, UCHAR, long, unsigned char, -, UCHAR_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -5368,7 +5425,7 @@ H5T_conv_ulong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_ulong_schar, FAIL);
- H5T_CONV_Us(ULONG, SCHAR, unsigned long, signed char, SCHAR_MAX);
+ H5T_CONV_Us(ULONG, SCHAR, unsigned long, signed char, -, SCHAR_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -5401,7 +5458,7 @@ H5T_conv_ulong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_ulong_uchar, FAIL);
- H5T_CONV_Uu(ULONG, UCHAR, unsigned long, unsigned char, UCHAR_MAX);
+ H5T_CONV_Uu(ULONG, UCHAR, unsigned long, unsigned char, -, UCHAR_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -5466,7 +5523,7 @@ H5T_conv_long_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_long_ushort, FAIL);
- H5T_CONV_Su(LONG, USHORT, long, unsigned short, USHRT_MAX);
+ H5T_CONV_Su(LONG, USHORT, long, unsigned short, -, USHRT_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -5498,7 +5555,7 @@ H5T_conv_ulong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_ulong_short, FAIL);
- H5T_CONV_Us(ULONG, SHORT, unsigned long, short, SHRT_MAX);
+ H5T_CONV_Us(ULONG, SHORT, unsigned long, short, -, SHRT_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -5531,7 +5588,7 @@ H5T_conv_ulong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_ulong_ushort, FAIL);
- H5T_CONV_Uu(ULONG, USHORT, unsigned long, unsigned short, USHRT_MAX);
+ H5T_CONV_Uu(ULONG, USHORT, unsigned long, unsigned short, -, USHRT_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -5595,7 +5652,7 @@ H5T_conv_long_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_long_uint, FAIL);
- H5T_CONV_Su(LONG, UINT, long, unsigned, UINT_MAX);
+ H5T_CONV_Su(LONG, UINT, long, unsigned, -, UINT_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -5627,7 +5684,7 @@ H5T_conv_ulong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_ulong_int, FAIL);
- H5T_CONV_Us(ULONG, INT, unsigned long, int, INT_MAX);
+ H5T_CONV_Us(ULONG, INT, unsigned long, int, -, INT_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -5659,7 +5716,7 @@ H5T_conv_ulong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_ulong_uint, FAIL);
- H5T_CONV_Uu(ULONG, UINT, unsigned long, unsigned, UINT_MAX);
+ H5T_CONV_Uu(ULONG, UINT, unsigned long, unsigned, -, UINT_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -5691,7 +5748,7 @@ H5T_conv_long_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_long_ulong, FAIL);
- H5T_CONV_su(LONG, ULONG, long, unsigned long);
+ H5T_CONV_su(LONG, ULONG, long, unsigned long, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -5723,7 +5780,7 @@ H5T_conv_ulong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_ulong_long, FAIL);
- H5T_CONV_us(ULONG, LONG, unsigned long, long, LONG_MAX);
+ H5T_CONV_us(ULONG, LONG, unsigned long, long, -, LONG_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -5755,7 +5812,7 @@ H5T_conv_long_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_long_llong, FAIL);
- H5T_CONV_sS(LONG, LLONG, long, long_long);
+ H5T_CONV_sS(LONG, LLONG, long, long_long, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -5788,7 +5845,7 @@ H5T_conv_long_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_long_ullong, FAIL);
- H5T_CONV_sU(LONG, ULLONG, long, unsigned long_long);
+ H5T_CONV_sU(LONG, ULLONG, long, unsigned long_long, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -5821,7 +5878,7 @@ H5T_conv_ulong_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_long_llong, FAIL);
- H5T_CONV_uS(ULONG, LLONG, unsigned long, long_long, LLONG_MAX);
+ H5T_CONV_uS(ULONG, LLONG, unsigned long, long_long, -, LLONG_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -5854,7 +5911,7 @@ H5T_conv_ulong_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_ulong_ullong, FAIL);
- H5T_CONV_uU(ULONG, ULLONG, unsigned long, unsigned long_long);
+ H5T_CONV_uU(ULONG, ULLONG, unsigned long, unsigned long_long, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -5920,7 +5977,7 @@ H5T_conv_llong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_llong_uchar, FAIL);
- H5T_CONV_Su(LLONG, UCHAR, long_long, unsigned char, UCHAR_MAX);
+ H5T_CONV_Su(LLONG, UCHAR, long_long, unsigned char, -, UCHAR_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -5953,7 +6010,7 @@ H5T_conv_ullong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_ullong_schar, FAIL);
- H5T_CONV_Us(ULLONG, SCHAR, unsigned long_long, signed char, SCHAR_MAX);
+ H5T_CONV_Us(ULLONG, SCHAR, unsigned long_long, signed char, -, SCHAR_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -5986,7 +6043,7 @@ H5T_conv_ullong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_ullong_uchar, FAIL);
- H5T_CONV_Uu(ULLONG, UCHAR, unsigned long_long, unsigned char, UCHAR_MAX);
+ H5T_CONV_Uu(ULLONG, UCHAR, unsigned long_long, unsigned char, -, UCHAR_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -6052,7 +6109,7 @@ H5T_conv_llong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_llong_ushort, FAIL);
- H5T_CONV_Su(LLONG, USHORT, long_long, unsigned short, USHRT_MAX);
+ H5T_CONV_Su(LLONG, USHORT, long_long, unsigned short, -, USHRT_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -6085,7 +6142,7 @@ H5T_conv_ullong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_ullong_short, FAIL);
- H5T_CONV_Us(ULLONG, SHORT, unsigned long_long, short, SHRT_MAX);
+ H5T_CONV_Us(ULLONG, SHORT, unsigned long_long, short, -, SHRT_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -6118,7 +6175,7 @@ H5T_conv_ullong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_ullong_ushort, FAIL);
- H5T_CONV_Uu(ULLONG, USHORT, unsigned long_long, unsigned short, USHRT_MAX);
+ H5T_CONV_Uu(ULLONG, USHORT, unsigned long_long, unsigned short, -, USHRT_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -6182,7 +6239,7 @@ H5T_conv_llong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_llong_uint, FAIL);
- H5T_CONV_Su(LLONG, UINT, long_long, unsigned, UINT_MAX);
+ H5T_CONV_Su(LLONG, UINT, long_long, unsigned, -, UINT_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -6214,7 +6271,7 @@ H5T_conv_ullong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_ullong_int, FAIL);
- H5T_CONV_Us(ULLONG, INT, unsigned long_long, int, INT_MAX);
+ H5T_CONV_Us(ULLONG, INT, unsigned long_long, int, -, INT_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -6247,7 +6304,7 @@ H5T_conv_ullong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_ullong_uint, FAIL);
- H5T_CONV_Uu(ULLONG, UINT, unsigned long_long, unsigned, UINT_MAX);
+ H5T_CONV_Uu(ULLONG, UINT, unsigned long_long, unsigned, -, UINT_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -6312,7 +6369,7 @@ H5T_conv_llong_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_llong_ulong, FAIL);
- H5T_CONV_Su(LLONG, ULONG, long_long, unsigned long, ULONG_MAX);
+ H5T_CONV_Su(LLONG, ULONG, long_long, unsigned long, -, ULONG_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -6345,7 +6402,7 @@ H5T_conv_ullong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_ullong_long, FAIL);
- H5T_CONV_Us(ULLONG, LONG, unsigned long_long, long, LONG_MAX);
+ H5T_CONV_Us(ULLONG, LONG, unsigned long_long, long, -, LONG_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -6378,7 +6435,7 @@ H5T_conv_ullong_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_ullong_ulong, FAIL);
- H5T_CONV_Uu(ULLONG, ULONG, unsigned long_long, unsigned long, ULONG_MAX);
+ H5T_CONV_Uu(ULLONG, ULONG, unsigned long_long, unsigned long, -, ULONG_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -6411,7 +6468,7 @@ H5T_conv_llong_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_llong_ullong, FAIL);
- H5T_CONV_su(LLONG, ULLONG, long_long, unsigned long_long);
+ H5T_CONV_su(LLONG, ULLONG, long_long, unsigned long_long, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -6444,7 +6501,7 @@ H5T_conv_ullong_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
FUNC_ENTER_NOAPI(H5T_conv_ullong_llong, FAIL);
- H5T_CONV_us(ULLONG, LLONG, unsigned long_long, long_long, LLONG_MAX);
+ H5T_CONV_us(ULLONG, LLONG, unsigned long_long, long_long, -, LLONG_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -6476,92 +6533,11 @@ H5T_conv_float_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
- hsize_t elmtno; /*element number */
- uint8_t *src, *s; /*source buffer */
- uint8_t *dst, *d; /*destination buffer */
- H5T_t *st, *dt; /*type descriptors */
- hbool_t src_mv, dst_mv; /*align data? */
- double aligned; /*aligned data */
herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5T_conv_float_double, FAIL);
- switch (cdata->command) {
- case H5T_CONV_INIT:
- cdata->need_bkg = H5T_BKG_NO;
- if (NULL==(st=H5I_object(src_id)) ||
- NULL==(dt=H5I_object(dst_id)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to dereference data type object ID");
- if (st->size!=sizeof(float) || dt->size!=sizeof(double))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "disagreement about data type size");
- CI_ALLOC_PRIV
- break;
-
- case H5T_CONV_FREE:
- CI_PRINT_STATS(FLOAT, DOUBLE);
- CI_FREE_PRIV
- break;
-
- case H5T_CONV_CONV:
- if (buf_stride) {
- src = dst = (uint8_t*)buf + buf_stride*(nelmts-1);
- } else {
- src = (uint8_t*)buf + sizeof(float)*(nelmts-1);
- dst = (uint8_t*)buf + sizeof(double)*(nelmts-1);
- }
-
- /* Need alignment? */
- if (H5T_NATIVE_FLOAT_ALIGN_g>1) {
- src_mv = ((size_t)buf % H5T_NATIVE_FLOAT_ALIGN_g) ||
- ((buf_stride?buf_stride:sizeof(float)) %
- H5T_NATIVE_FLOAT_ALIGN_g);
- } else {
- src_mv = FALSE;
- }
- if (H5T_NATIVE_DOUBLE_ALIGN_g>1) {
- dst_mv = ((size_t)buf % H5T_NATIVE_DOUBLE_ALIGN_g) ||
- ((buf_stride?buf_stride:sizeof(double)) %
- H5T_NATIVE_DOUBLE_ALIGN_g);
- } else {
- dst_mv = FALSE;
- }
- CI_INC_SRC(src_mv)
- CI_INC_DST(dst_mv)
-
- for (elmtno=0; elmtno<nelmts; elmtno++) {
- /* Align source and/or destination */
- if (src_mv) {
- HDmemcpy(&aligned, src, sizeof(float));
- s = (uint8_t*)&aligned;
- } else {
- s = src;
- }
- if (dst_mv)
- d = (uint8_t*)&aligned;
- else
- d = dst;
-
- /* Conversion */
- *((double*)d) = *((float*)s);
-
- /* Unalign destination */
- if (dst_mv)
- HDmemcpy(dst, &aligned, sizeof(double));
+ FUNC_ENTER_NOAPI(H5T_conv_float_double, FAIL);
- /* Advance buffer pointers */
- if (buf_stride) {
- src -= buf_stride;
- dst -= buf_stride;
- } else {
- src -= sizeof(float);
- dst -= sizeof(double);
- }
- }
- break;
-
- default:
- HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command");
- }
+ H5T_CONV_fF(FLOAT, DOUBLE, float, double, -, -);
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -6596,100 +6572,11 @@ H5T_conv_double_float (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dxpl_id)
{
- hsize_t elmtno; /*element number */
- uint8_t *src, *s; /*source buffer */
- uint8_t *dst, *d; /*destination buffer */
- H5T_t *st, *dt; /*type descriptors */
- hbool_t src_mv, dst_mv; /*align data? */
- double aligned; /*aligned data */
herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5T_conv_double_float, FAIL);
- switch (cdata->command) {
- case H5T_CONV_INIT:
- cdata->need_bkg = H5T_BKG_NO;
- if (NULL==(st=H5I_object(src_id)) ||
- NULL==(dt=H5I_object(dst_id)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to dereference data type object ID");
- if (st->size!=sizeof(double) || dt->size!=sizeof(float))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "disagreement about data type size");
- CI_ALLOC_PRIV
- break;
-
- case H5T_CONV_FREE:
- CI_PRINT_STATS(DOUBLE, FLOAT);
- CI_FREE_PRIV
- break;
-
- case H5T_CONV_CONV:
- src = (uint8_t*)buf;
- dst = (uint8_t*)buf;
-
- /* Need alignment? */
- if (H5T_NATIVE_DOUBLE_ALIGN_g>1) {
- src_mv = ((size_t)buf % H5T_NATIVE_DOUBLE_ALIGN_g) ||
- ((buf_stride?buf_stride:sizeof(double)) %
- H5T_NATIVE_DOUBLE_ALIGN_g);
- } else {
- src_mv = FALSE;
- }
- if (H5T_NATIVE_FLOAT_ALIGN_g>1) {
- dst_mv = ((size_t)buf % H5T_NATIVE_FLOAT_ALIGN_g) ||
- ((buf_stride?buf_stride:sizeof(float)) %
- H5T_NATIVE_FLOAT_ALIGN_g);
- } else {
- dst_mv = FALSE;
- }
- CI_INC_SRC(src_mv)
- CI_INC_DST(dst_mv)
-
- for (elmtno=0; elmtno<nelmts; elmtno++) {
- /* Align source and/or destination */
- if (src_mv) {
- HDmemcpy(&aligned, src, sizeof(double));
- s = (uint8_t*)&aligned;
- } else {
- s = src;
- }
- if (dst_mv)
- d = (uint8_t*)&aligned;
- else
- d = dst;
-
- /* Conversion */
- if (*((double*)s) > FLT_MAX) {
- if (!H5T_overflow_g ||
- (H5T_overflow_g)(src_id, dst_id, s, d)<0) {
- *((float*)d) = FLT_MAX;
- }
- } else if (*((double*)s) < -FLT_MAX) {
- if (!H5T_overflow_g ||
- (H5T_overflow_g)(src_id, dst_id, s, d)<0) {
- *((float*)d) = -FLT_MAX;
- }
- } else {
- *((float*)d) = (float) *((double*)s);
- }
-
- /* Unalign destination */
- if (dst_mv)
- HDmemcpy(dst, &aligned, sizeof(float));
+ FUNC_ENTER_NOAPI(H5T_conv_float_double, FAIL);
- /* Advance pointers */
- if (buf_stride) {
- src += buf_stride;
- dst += buf_stride;
- } else {
- src += sizeof(double);
- dst += sizeof(float);
- }
- }
- break;
-
- default:
- HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command");
- }
+ H5T_CONV_Ff(DOUBLE, FLOAT, double, float, FLT_MIN, FLT_MAX);
done:
FUNC_LEAVE_NOAPI(ret_value);
diff --git a/src/H5private.h b/src/H5private.h
index b72df0a..9b9cf41 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -1325,6 +1325,10 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */
# define PABLO_TRACE_OFF(m, f) /*void */
#endif
+/* Macro for "glueing" together items, for re-scanning macros */
+#define H5_GLUE(x,y) x##y
+#define H5_GLUE3(x,y,z) x##y##z
+
/* Private functions, not part of the publicly documented API */
H5_DLL herr_t H5_init_library(void);
H5_DLL void H5_term_library(void);