summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/cmake/ConfigureChecks.cmake83
-rw-r--r--config/cmake/ConversionTests.c122
-rw-r--r--config/cmake/H5pubconf.h.in12
-rw-r--r--configure.ac103
-rw-r--r--doxygen/dox/DDLBNF112.dox2
-rw-r--r--doxygen/dox/DDLBNF114.dox654
-rw-r--r--doxygen/dox/IntroHDF5.dox2
-rw-r--r--doxygen/dox/LearnBasics1.dox4
-rw-r--r--doxygen/dox/LearnBasics2.dox5
-rw-r--r--doxygen/dox/Specifications.dox1
-rw-r--r--doxygen/examples/tables/predefinedDatatypes.dox12
-rw-r--r--hl/src/H5LT.c13
-rw-r--r--hl/src/H5LTanalyze.c456
-rw-r--r--hl/src/H5LTanalyze.l3
-rw-r--r--hl/src/H5LTparse.c789
-rw-r--r--hl/src/H5LTparse.h63
-rw-r--r--hl/src/H5LTparse.y8
-rw-r--r--java/src/hdf/hdf5lib/HDF5Constants.java12
-rw-r--r--java/src/jni/h5Constants.c15
-rw-r--r--java/src/jni/h5util.c8
-rw-r--r--release_docs/RELEASE.txt119
-rw-r--r--src/H5Fmodule.h2
-rw-r--r--src/H5Gmodule.h2
-rw-r--r--src/H5T.c570
-rw-r--r--src/H5Tconv.c435
-rw-r--r--src/H5Tinit_float.c48
-rw-r--r--src/H5Tmodule.h19
-rw-r--r--src/H5Tnative.c28
-rw-r--r--src/H5Tpkg.h96
-rw-r--r--src/H5Tpublic.h19
-rw-r--r--src/H5private.h38
-rw-r--r--src/H5trace.c8
-rw-r--r--test/API/H5_api_dataset_test.c10
-rw-r--r--test/API/H5_api_test_util.c14
-rw-r--r--test/dt_arith.c1062
-rw-r--r--test/dtypes.c425
-rw-r--r--test/ntypes.c121
-rw-r--r--tools/lib/h5diff_array.c265
-rw-r--r--tools/lib/h5diff_util.c10
-rw-r--r--tools/lib/h5tools_dump.c10
-rw-r--r--tools/lib/h5tools_str.c12
-rw-r--r--tools/lib/h5tools_type.c8
-rw-r--r--tools/src/h5import/h5import.c108
-rw-r--r--tools/src/h5ls/h5ls.c13
-rw-r--r--tools/test/h5dump/CMakeTests.cmake8
-rw-r--r--tools/test/h5dump/CMakeTestsXML.cmake8
-rw-r--r--tools/test/h5dump/expected/tfloat16.ddl46
-rw-r--r--tools/test/h5dump/expected/tfloat16_be.ddl46
-rw-r--r--tools/test/h5dump/expected/xml/tfloat16.h5.xml302
-rw-r--r--tools/test/h5dump/expected/xml/tfloat16_be.h5.xml302
-rw-r--r--tools/test/h5dump/h5dumpgentest.c163
-rw-r--r--tools/test/h5dump/testfiles/tfloat16.h5bin0 -> 2304 bytes
-rw-r--r--tools/test/h5dump/testfiles/tfloat16_be.h5bin0 -> 2304 bytes
-rw-r--r--tools/test/h5dump/testh5dump.sh.in8
-rw-r--r--tools/test/h5dump/testh5dumpxml.sh.in8
-rw-r--r--tools/test/h5ls/CMakeTests.cmake33
-rw-r--r--tools/test/h5ls/expected/tfloat16.ls8
-rw-r--r--tools/test/h5ls/expected/tfloat16_be.ls8
-rw-r--r--tools/test/h5ls/expected/tfloat16_be_nosupport.ls8
-rw-r--r--tools/test/h5ls/expected/tfloat16_nosupport.ls8
-rw-r--r--tools/test/h5ls/testh5ls.sh.in20
61 files changed, 5765 insertions, 1020 deletions
diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake
index 668739e..7272cb9 100644
--- a/config/cmake/ConfigureChecks.cmake
+++ b/config/cmake/ConfigureChecks.cmake
@@ -858,7 +858,8 @@ macro (H5ConversionTests TEST def msg)
${CMAKE_BINARY_DIR}
${HDF_RESOURCES_DIR}/ConversionTests.c
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=-D${TEST}_TEST
- OUTPUT_VARIABLE OUTPUT
+ COMPILE_OUTPUT_VARIABLE ${TEST}_COMPILE_OUTPUT
+ RUN_OUTPUT_VARIABLE ${TEST}_RUN_OUTPUT
)
if (${TEST}_COMPILE)
if (${TEST}_RUN EQUAL "0")
@@ -868,14 +869,17 @@ macro (H5ConversionTests TEST def msg)
set (${TEST} "" CACHE INTERNAL ${msg})
message (VERBOSE "${msg}... no")
file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
- "Test ${TEST} Run failed with the following output and exit code:\n ${OUTPUT}\n"
+ "Test ${TEST} Compile succeeded with the following output:\n ${${TEST}_COMPILE_OUTPUT}\n"
+ )
+ file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
+ "Test ${TEST} Run failed with exit code ${${TEST}_RUN} and with the following output:\n ${${TEST}_RUN_OUTPUT}\n"
)
endif ()
else ()
set (${TEST} "" CACHE INTERNAL ${msg})
message (VERBOSE "${msg}... no")
file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
- "Test ${TEST} Compile failed with the following output:\n ${OUTPUT}\n"
+ "Test ${TEST} Compile failed with the following output:\n ${${TEST}_COMPILE_OUTPUT}\n"
)
endif ()
else ()
@@ -937,3 +941,76 @@ H5ConversionTests (${HDF_PREFIX}_LLONG_TO_LDOUBLE_CORRECT TRUE "Checking IF corr
# some long double values
#-----------------------------------------------------------------------------
H5ConversionTests (${HDF_PREFIX}_DISABLE_SOME_LDOUBLE_CONV FALSE "Checking IF the cpu is power9 and cannot correctly converting long double values")
+
+#-----------------------------------------------------------------------------
+# Check if _Float16 type is available
+#-----------------------------------------------------------------------------
+message (STATUS "Checking if _Float16 support is available")
+set (${HDF_PREFIX}_HAVE__FLOAT16 0)
+HDF_CHECK_TYPE_SIZE (_Float16 ${HDF_PREFIX}_SIZEOF__FLOAT16)
+if (${HDF_PREFIX}_SIZEOF__FLOAT16)
+ # Request _Float16 support
+ set (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} "-D__STDC_WANT_IEC_60559_TYPES_EXT__")
+
+ # Some compilers expose the _Float16 datatype, but not the macros and
+ # functions used with the datatype. We need the macros for proper
+ # datatype conversion support. Check for these here.
+ CHECK_SYMBOL_EXISTS (FLT16_EPSILON "float.h" h5_have_flt16_epsilon)
+ CHECK_SYMBOL_EXISTS (FLT16_MIN "float.h" h5_have_flt16_min)
+ CHECK_SYMBOL_EXISTS (FLT16_MAX "float.h" h5_have_flt16_max)
+ CHECK_SYMBOL_EXISTS (FLT16_MIN_10_EXP "float.h" h5_have_flt16_min_10_exp)
+ CHECK_SYMBOL_EXISTS (FLT16_MAX_10_EXP "float.h" h5_have_flt16_max_10_exp)
+ CHECK_SYMBOL_EXISTS (FLT16_MANT_DIG "float.h" h5_have_flt16_mant_dig)
+
+ if (h5_have_flt16_epsilon AND h5_have_flt16_min AND
+ h5_have_flt16_max AND h5_have_flt16_min_10_exp AND
+ h5_have_flt16_max_10_exp AND h5_have_flt16_mant_dig)
+ # Some compilers like OneAPI on Windows appear to detect _Float16 support
+ # properly up to this point, and, in the absence of any architecture-specific
+ # tuning compiler flags, will generate code for H5Tconv.c that performs
+ # software conversions on _Float16 variables with compiler-internal functions
+ # such as __extendhfsf2, __truncsfhf2, or __truncdfhf2. However, these
+ # compilers will fail to link these functions into the build for currently
+ # unknown reasons and cause the build to fail. Since these are compiler-internal
+ # functions that we don't appear to have much control over, let's try to
+ # compile a program that will generate these functions to check for _Float16
+ # support. If we fail to compile this program, we will simply disable
+ # _Float16 support for the time being.
+ H5ConversionTests (
+ ${HDF_PREFIX}_FLOAT16_CONVERSION_FUNCS_LINK
+ FALSE
+ "Checking if compiler can convert _Float16 type with casts"
+ )
+
+ if (${${HDF_PREFIX}_FLOAT16_CONVERSION_FUNCS_LINK})
+ # Finally, MacOS 13 appears to have a bug specifically when converting
+ # long double values to _Float16. Release builds of the dt_arith test
+ # would cause any assignments to a _Float16 variable to be elided,
+ # whereas Debug builds would perform incorrect hardware conversions by
+ # simply chopping off all the bytes of the value except for the first 2.
+ # These tests pass on MacOS 14, so let's perform a quick test to check
+ # if the hardware conversion is done correctly.
+ H5ConversionTests (
+ ${HDF_PREFIX}_LDOUBLE_TO_FLOAT16_CORRECT
+ TRUE
+ "Checking if correctly converting long double to _Float16 values"
+ )
+
+ if (NOT ${${HDF_PREFIX}_LDOUBLE_TO_FLOAT16_CORRECT})
+ message (VERBOSE "Conversions from long double to _Float16 appear to be incorrect. These will be emulated through a soft conversion function.")
+ endif ()
+
+ set (${HDF_PREFIX}_HAVE__FLOAT16 1)
+
+ # Check if we can use fabsf16
+ CHECK_FUNCTION_EXISTS (fabsf16 ${HDF_PREFIX}_HAVE_FABSF16)
+ else ()
+ message (STATUS "_Float16 support has been disabled because the compiler couldn't compile and run a test program for _Float16 conversions")
+ message (STATUS "Check ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log for information on why the test program couldn't be compiled/run")
+ endif ()
+ else ()
+ message (STATUS "_Float16 support has been disabled since the required macros (FLT16_MAX, FLT16_EPSILON, etc. were not found)")
+ endif ()
+else ()
+ message (STATUS "_Float16 support has been disabled since the _Float16 type was not found")
+endif ()
diff --git a/config/cmake/ConversionTests.c b/config/cmake/ConversionTests.c
index 725f049..8e103bd 100644
--- a/config/cmake/ConversionTests.c
+++ b/config/cmake/ConversionTests.c
@@ -285,3 +285,125 @@ int HDF_NO_UBSAN main(void)
}
#endif
+
+#ifdef H5_FLOAT16_CONVERSION_FUNCS_LINK_TEST
+
+#define __STDC_WANT_IEC_60559_TYPES_EXT__
+
+#include <stdlib.h>
+#include <float.h>
+
+int HDF_NO_UBSAN main(void)
+{
+ _Float16 fl16_var;
+ signed char sc;
+ unsigned char usc;
+ short s;
+ unsigned short us;
+ int i;
+ unsigned int ui;
+ long l;
+ unsigned long ul;
+ long long ll;
+ unsigned long long ull;
+ float f;
+ double d;
+ long double ld;
+ int ret = 0;
+
+ /*
+ * Cast the _Float16 type between all the different C datatypes
+ * we support conversions for in H5Tconv.c to check if the compiler
+ * properly links any software conversion functions it may generate
+ * for the casts, such as __extendhfsf2 or __truncdfhf2.
+ */
+
+ fl16_var = 3.0f16;
+
+ sc = (signed char)fl16_var;
+ usc = (unsigned char)fl16_var;
+ s = (short)fl16_var;
+ us = (unsigned short)fl16_var;
+ i = (int)fl16_var;
+ ui = (unsigned int)fl16_var;
+ l = (long)fl16_var;
+ ul = (unsigned long)fl16_var;
+ ll = (long long)fl16_var;
+ ull = (unsigned long long)fl16_var;
+ f = (float)fl16_var;
+ d = (double)fl16_var;
+ ld = (long double)fl16_var;
+
+ sc = (signed char)3;
+ fl16_var = (_Float16)sc;
+
+ usc = (unsigned char)3;
+ fl16_var = (_Float16)usc;
+
+ s = (short)3;
+ fl16_var = (_Float16)s;
+
+ us = (unsigned short)3;
+ fl16_var = (_Float16)us;
+
+ i = (int)3;
+ fl16_var = (_Float16)i;
+
+ ui = (unsigned int)3;
+ fl16_var = (_Float16)ui;
+
+ l = (long)3;
+ fl16_var = (_Float16)l;
+
+ ul = (unsigned long)3;
+ fl16_var = (_Float16)ul;
+
+ ll = (long long)3;
+ fl16_var = (_Float16)ll;
+
+ ull = (unsigned long long)3;
+ fl16_var = (_Float16)ull;
+
+ f = (float)3.0f;
+ fl16_var = (_Float16)f;
+
+ d = (double)3.0;
+ fl16_var = (_Float16)d;
+
+ ld = (long double)3.0l;
+ fl16_var = (_Float16)ld;
+
+done:
+ exit(ret);
+}
+
+#endif
+
+#ifdef H5_LDOUBLE_TO_FLOAT16_CORRECT_TEST
+
+#define __STDC_WANT_IEC_60559_TYPES_EXT__
+
+#include <stdlib.h>
+#include <float.h>
+#include <math.h>
+#include <limits.h>
+
+int HDF_NO_UBSAN main(void)
+{
+ long double ld;
+ _Float16 half;
+ int ret = 1;
+
+ ld = 32.0L;
+ half = 64.0f16;
+
+ half = (_Float16)ld;
+
+ if (fabsl(ld - (long double)half) < LDBL_EPSILON)
+ ret = 0;
+
+done:
+ exit(ret);
+}
+
+#endif
diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in
index f835da1..5e6ea54 100644
--- a/config/cmake/H5pubconf.h.in
+++ b/config/cmake/H5pubconf.h.in
@@ -131,6 +131,9 @@
/* Define if library information should be embedded in the executables */
#cmakedefine H5_HAVE_EMBEDDED_LIBINFO @H5_HAVE_EMBEDDED_LIBINFO@
+/* Define to 1 if you have the `fabsf16' function. */
+#cmakedefine H5_HAVE_FABSF16 @H5_HAVE_FABSF16@
+
/* Define to 1 if you have the `fcntl' function. */
#cmakedefine H5_HAVE_FCNTL @H5_HAVE_FCNTL@
@@ -143,6 +146,9 @@
/* Define if support for szip filter is enabled */
#cmakedefine H5_HAVE_FILTER_SZIP @H5_HAVE_FILTER_SZIP@
+/* Determine if _Float16 is available */
+#cmakedefine H5_HAVE__FLOAT16 @H5_HAVE__FLOAT16@
+
/* Determine if __float128 is available */
#cmakedefine H5_HAVE_FLOAT128 @H5_HAVE_FLOAT128@
@@ -390,6 +396,9 @@
/* Define if new-style references should be used with dimension scales */
#cmakedefine H5_DIMENSION_SCALES_WITH_NEW_REF @H5_DIMENSION_SCALES_WITH_NEW_REF@
+/* Define if your system can convert long double to _Float16 values correctly. */
+#cmakedefine H5_LDOUBLE_TO_FLOAT16_CORRECT @H5_LDOUBLE_TO_FLOAT16_CORRECT@
+
/* Define if your system can convert long double to (unsigned) long long
values correctly. */
#cmakedefine H5_LDOUBLE_TO_LLONG_ACCURATE @H5_LDOUBLE_TO_LLONG_ACCURATE@
@@ -592,6 +601,9 @@
/* The size of `_Quad', as computed by sizeof. */
#define H5_SIZEOF__QUAD @H5_SIZEOF__QUAD@
+/* The size of `_Float16', as computed by sizeof. */
+#define H5_SIZEOF__FLOAT16 @H5_SIZEOF__FLOAT16@
+
/* The size of `__float128', as computed by sizeof. */
#define H5_SIZEOF___FLOAT128 @H5_SIZEOF___FLOAT128@
diff --git a/configure.ac b/configure.ac
index b76f18f..f33fb8b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -560,6 +560,109 @@ AC_CHECK_SIZEOF([double])
AC_CHECK_SIZEOF([long double])
## ----------------------------------------------------------------------
+## Check if _Float16 support is available
+##
+AC_MSG_NOTICE([checking if _Float16 support is available])
+HAVE__FLOAT16="no"
+AC_CHECK_SIZEOF([_Float16])
+if test "$ac_cv_sizeof__Float16" != 0; then
+ # Some compilers expose the _Float16 datatype, but not the macros and
+ # functions used with the datatype. We need the macros for proper
+ # datatype conversion support. Check for these here.
+ AC_CHECK_DECL([FLT16_EPSILON], [], [], [[
+ #define __STDC_WANT_IEC_60559_TYPES_EXT__
+ #include <float.h>]])
+ AC_CHECK_DECL([FLT16_MIN], [], [], [[
+ #define __STDC_WANT_IEC_60559_TYPES_EXT__
+ #include <float.h>]])
+ AC_CHECK_DECL([FLT16_MAX], [], [], [[
+ #define __STDC_WANT_IEC_60559_TYPES_EXT__
+ #include <float.h>]])
+ AC_CHECK_DECL([FLT16_MIN_10_EXP], [], [], [[
+ #define __STDC_WANT_IEC_60559_TYPES_EXT__
+ #include <float.h>]])
+ AC_CHECK_DECL([FLT16_MAX_10_EXP], [], [], [[
+ #define __STDC_WANT_IEC_60559_TYPES_EXT__
+ #include <float.h>]])
+ AC_CHECK_DECL([FLT16_MANT_DIG], [], [], [[
+ #define __STDC_WANT_IEC_60559_TYPES_EXT__
+ #include <float.h>]])
+
+ if test "X$ac_cv_have_decl_FLT16_EPSILON" = "Xyes" &&
+ test "X$ac_cv_have_decl_FLT16_MIN" = "Xyes" &&
+ test "X$ac_cv_have_decl_FLT16_MAX" = "Xyes" &&
+ test "X$ac_cv_have_decl_FLT16_MIN_10_EXP" = "Xyes" &&
+ test "X$ac_cv_have_decl_FLT16_MAX_10_EXP" = "Xyes" &&
+ test "X$ac_cv_have_decl_FLT16_MANT_DIG" = "Xyes" ; then
+ # Some compilers like OneAPI on Windows appear to detect _Float16 support
+ # properly up to this point, and, in the absence of any architecture-specific
+ # tuning compiler flags, will generate code for H5Tconv.c that performs
+ # software conversions on _Float16 variables with compiler-internal functions
+ # such as __extendhfsf2, __truncsfhf2, or __truncdfhf2. However, these
+ # compilers will fail to link these functions into the build for currently
+ # unknown reasons and cause the build to fail. Since these are compiler-internal
+ # functions that we don't appear to have much control over, let's try to
+ # compile a program that will generate these functions to check for _Float16
+ # support. If we fail to compile this program, we will simply disable
+ # _Float16 support for the time being.
+ AC_MSG_CHECKING([if compiler can correctly compile and run a test program which converts _Float16 to other types with casts])
+ TEST_SRC="`(echo \"#define H5_FLOAT16_CONVERSION_FUNCS_LINK_TEST 1\"; cat $srcdir/config/cmake/ConversionTests.c)`"
+ AC_CACHE_VAL([hdf5_cv_float16_conversion_funcs_link],
+ [AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([$TEST_SRC])],
+ [hdf5_cv_float16_conversion_funcs_link=yes], [hdf5_cv_float16_conversion_funcs_link=no], [hdf5_cv_float16_conversion_funcs_link=no])])
+
+ if test ${hdf5_cv_float16_conversion_funcs_link} = "yes"; then
+ AC_MSG_RESULT([yes])
+
+ # Finally, MacOS 13 appears to have a bug specifically when converting
+ # long double values to _Float16. Release builds of the dt_arith test
+ # would cause any assignments to a _Float16 variable to be elided,
+ # whereas Debug builds would perform incorrect hardware conversions by
+ # simply chopping off all the bytes of the value except for the first 2.
+ # These tests pass on MacOS 14, so let's perform a quick test to check
+ # if the hardware conversion is done correctly.
+ AC_MSG_CHECKING([if compiler can correctly convert long double values to _Float16])
+ TEST_SRC="`(echo \"#define H5_LDOUBLE_TO_FLOAT16_CORRECT_TEST 1\"; cat $srcdir/config/cmake/ConversionTests.c)`"
+ if test ${ac_cv_sizeof_long_double} = 0; then
+ hdf5_cv_ldouble_to_float16_correct=${hdf5_cv_ldouble_to_float16_correct=no}
+ else
+ AC_CACHE_VAL([hdf5_cv_ldouble_to_float16_correct],
+ [AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([$TEST_SRC])],
+ [hdf5_cv_ldouble_to_float16_correct=yes], [hdf5_cv_ldouble_to_float16_correct=no], [hdf5_cv_ldouble_to_float16_correct=yes])])
+ fi
+
+ if test ${hdf5_cv_ldouble_to_float16_correct} = "yes"; then
+ AC_DEFINE([LDOUBLE_TO_FLOAT16_CORRECT], [1],
+ [Define if your system can convert long double to _Float16 values correctly.])
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ AC_MSG_NOTICE([Conversions from long double to _Float16 appear to be incorrect. These will be emulated through a soft conversion function.])
+ fi
+
+ HAVE__FLOAT16="yes"
+
+ # Check if we can use fabsf16
+ AC_CHECK_FUNC([fabsf16], [AC_DEFINE([HAVE_FABSF16], [1],
+ [Define if has fabsf16 function])], [])
+
+ # Define HAVE__FLOAT16 macro for H5pubconf.h if _Float16 is available.
+ AC_DEFINE([HAVE__FLOAT16], [1], [Determine if _Float16 is available])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ fi
+
+ AC_MSG_CHECKING([if _Float16 support is enabled])
+ AC_MSG_RESULT([$HAVE__FLOAT16])
+fi
+
+# Define HAVE__FLOAT16 value to substitute into other files for conditional testing
+AC_SUBST([HAVE__FLOAT16])
+
+## ----------------------------------------------------------------------
## Check if the Fortran interface should be enabled
##
diff --git a/doxygen/dox/DDLBNF112.dox b/doxygen/dox/DDLBNF112.dox
index 6809a06..cfe34c3 100644
--- a/doxygen/dox/DDLBNF112.dox
+++ b/doxygen/dox/DDLBNF112.dox
@@ -1,4 +1,4 @@
-/** \page DDLBNF112 DDL in BNF for HDF5 1.12 and above
+/** \page DDLBNF112 DDL in BNF for HDF5 1.12 through HDF5 1.14.3
\todo Revise this & break it up!
diff --git a/doxygen/dox/DDLBNF114.dox b/doxygen/dox/DDLBNF114.dox
new file mode 100644
index 0000000..61e9157
--- /dev/null
+++ b/doxygen/dox/DDLBNF114.dox
@@ -0,0 +1,654 @@
+/** \page DDLBNF114 DDL in BNF for HDF5 1.14.4 and above
+
+\todo Revise this & break it up!
+
+\section intro114 Introduction
+
+This document contains the data description language (DDL) for an HDF5 file. The
+description is in Backus-Naur Form (BNF).
+
+\section expo114 Explanation of Symbols
+
+This section contains a brief explanation of the symbols used in the DDL.
+
+\code{.unparsed}
+::= defined as
+ <tname> a token with the name tname
+ <a> | <b> one of <a> or <b>
+ <a>opt zero or one occurrence of <a>
+ <a>* zero or more occurrence of <a>
+ <a>+ one or more occurrence of <a>
+ [0-9] an element in the range between 0 and 9
+ '[' the token within the quotes (used for special characters)
+ TBD To Be Decided
+\endcode
+
+\section ddl114 The DDL
+
+\code{.unparsed}
+<file> ::= HDF5 <file_name> { <file_super_block>opt <root_group> }
+
+<file_name> ::= <identifier>
+
+<file_super_block> ::= SUPER_BLOCK {
+ SUPERBLOCK_VERSION <int_value>
+ FREELIST_VERSION <int_value>
+ SYMBOLTABLE_VERSION <int_value>
+ OBJECTHEADER_VERSION <int_value>
+ OFFSET_SIZE <int_value>
+ LENGTH_SIZE <int_value>
+ BTREE_RANK <int_value>
+ BTREE_LEAF <int_value>
+ ISTORE_K <int_value>
+ <super_block_filespace>
+ USER_BLOCK {
+ USERBLOCK_SIZE <int_value>
+ }
+ }
+
+<super_block_filespace> ::= FILE_SPACE_STRATEGY <super_block_strategy>
+ FREE_SPACE_PERSIST <boolean_value>
+ FREE_SPACE_SECTION_THRESHOLD <int_value>
+ FILE_SPACE_PAGE_SIZE <int_value>
+
+<super_block_strategy> ::= H5F_FSPACE_STRATEGY_FSM_AGGR | H5F_FSPACE_STRATEGY_PAGE |
+ H5F_FSPACE_STRATEGY_AGGR | H5F_FSPACE_STRATEGY_NONE |
+ Unknown strategy
+
+<root_group> ::= GROUP "/" {
+ <anon_named_datatype>*
+ <object_id>opt
+ <group_comment>opt
+ <group_attribute>*
+ <group_member>*
+ }
+
+<datatype> ::= <atomic_type> | <compound_type> | <variable_length_type> | <array_type>
+
+<anon_named_datatype> ::= DATATYPE <anon_named_type_name> {
+ <datatype>
+ }
+
+<anon_named_type_name> ::= the assigned name for anonymous named type is
+ in the form of #oid, where oid is the object id
+ of the type
+
+<atomic_type> ::= <integer> | <float> | <time> | <string> |
+ <bitfield> | <opaque> | <reference> | <enum>
+
+<boolean_value> ::= FALSE | TRUE
+
+<integer> ::= H5T_STD_I8BE | H5T_STD_I8LE |
+ H5T_STD_I16BE | H5T_STD_I16LE |
+ H5T_STD_I32BE | H5T_STD_I32LE |
+ H5T_STD_I64BE | H5T_STD_I64LE |
+ H5T_STD_U8BE | H5T_STD_U8LE |
+ H5T_STD_U16BE | H5T_STD_U16LE |
+ H5T_STD_U32BE | H5T_STD_U32LE |
+ H5T_STD_U64BE | H5T_STD_U64LE |
+ H5T_NATIVE_CHAR | H5T_NATIVE_UCHAR |
+ H5T_NATIVE_SHORT | H5T_NATIVE_USHORT |
+ H5T_NATIVE_INT | H5T_NATIVE_UINT |
+ H5T_NATIVE_LONG | H5T_NATIVE_ULONG |
+ H5T_NATIVE_LLONG | H5T_NATIVE_ULLONG
+
+<float> ::= H5T_IEEE_F16BE | H5T_IEEE_F16LE |
+ H5T_IEEE_F32BE | H5T_IEEE_F32LE |
+ H5T_IEEE_F64BE | H5T_IEEE_F64LE |
+ H5T_NATIVE_FLOAT16 | H5T_NATIVE_FLOAT |
+ H5T_NATIVE_DOUBLE | H5T_NATIVE_LDOUBLE
+
+<time> ::= H5T_TIME: not yet implemented
+
+<string> ::= H5T_STRING {
+ STRSIZE <strsize>;
+ STRPAD <strpad>;
+ CSET <cset>;
+ CTYPE <ctype>;
+ }
+
+<strsize> ::= <int_value>
+
+<strpad> ::= H5T_STR_NULLTERM | H5T_STR_NULLPAD | H5T_STR_SPACEPAD
+
+<cset> ::= H5T_CSET_ASCII | H5T_CSET_UTF8
+
+<ctype> ::= H5T_C_S1 | H5T_FORTRAN_S1
+
+<bitfield> ::= H5T_STD_B8BE | H5T_STD_B8LE |
+ H5T_STD_B16BE | H5T_STD_B16LE |
+ H5T_STD_B32BE | H5T_STD_B32LE |
+ H5T_STD_B64BE | H5T_STD_B64LE
+
+<opaque> ::= H5T_OPAQUE {
+ OPAQUE_TAG <identifier>;
+ OPAQUE_SIZE <int_value>;opt
+ }
+
+<reference> ::= H5T_REFERENCE { <ref_type> }
+
+<ref_type> ::= H5T_STD_REF_OBJECT | H5T_STD_REF_DSETREG | H5T_STD_REF | UNDEFINED
+
+<compound_type> ::= H5T_COMPOUND {
+ <member_type_def>+
+ }
+
+<member_type_def> ::= <datatype> <field_name>;
+
+<field_name> ::= <identifier>
+
+<variable_length_type> ::= H5T_VLEN { <datatype> }
+
+<array_type> ::= H5T_ARRAY { <dim_sizes> <datatype> }
+
+<dim_sizes> ::= '['<dimsize>']' | '['<dimsize>']'<dim_sizes>
+
+<dimsize> ::= <int_value>
+
+<attribute> ::= ATTRIBUTE <attr_name> {
+ <dataset_type>
+ <dataset_space>
+ <data>opt
+ }
+
+<attr_name> ::= <identifier>
+
+<dataset_type> ::= DATATYPE <path_name> | <datatype>
+
+<enum> ::= H5T_ENUM {
+ <enum_base_type> <enum_def>+
+ }
+
+<enum_base_type> ::= <integer>
+// Currently enums can only hold integer type data, but they may be expanded
+// in the future to hold any datatype
+
+<enum_def> ::= <enum_symbol> <enum_val>;
+
+<enum_symbol> ::= <identifier>
+
+<enum_val> ::= <int_value>
+
+<path_name> ::= <path_part>+
+
+<path_part> ::= /<identifier>
+
+<dataspace> ::= <scalar_space> | <simple_space> | <complex_space> | <null_space>
+
+<null_space> ::= NULL
+
+<scalar_space> ::= SCALAR
+
+<simple_space> ::= SIMPLE { <current_dims> / <max_dims> }
+
+<complex_space> ::= COMPLEX { <complex_space_definition> }
+
+<dataset_space> ::= DATASPACE <path_name> | <dataspace>
+
+<current_dims> ::= <dims>
+
+<max_dims> ::= '(' <max_dim_list> ')'
+
+<max_dim_list> ::= <max_dim> | <max_dim>, <max_dim_list>
+
+<max_dim> ::= <int_value> | H5S_UNLIMITED
+
+<data> ::= <subset> | <data_values>
+
+<data_values> ::= DATA {
+ <scalar_space_data> | <simple_space_data>
+ }
+
+<scalar_space_data> ::= <any_element>
+
+<any_element> ::= <atomic_element> | <compound_element> |
+ <variable_length_element> | <array_element>
+
+<any_data_seq> ::= <any_element> | <any_element>, <any_data_seq>
+
+<atomic_element> :: = <integer_data> | <float_data> | <time_data> |
+ <string_data> | <bitfield_data> | <opaque_data> |
+ <enum_data> | <reference_data>
+
+<subset> ::= SUBSET {
+ <start>;
+ <stride>;
+ <count>;
+ <block>;
+ DATA {
+ <simple_space_data>
+ }
+ }
+
+<start> ::= START (<coor_list>)
+
+<stride> ::= STRIDE (<pos_list>)
+
+<count> ::= COUNT (<max_dim_list>)
+
+<block> ::= BLOCK (<max_dim_list>)
+
+<coor_list> ::= <coor_data>, <coor_list> | <coor_data>
+
+<coor_data> ::= <integer_data> | H5S_UNLIMITED
+
+<integer_data> ::= <int_value>
+
+<float_data> ::= a floating point number
+
+<time_data> ::= DATA{ not yet implemented.}
+
+<string_data> ::= a string
+// A string is enclosed in double quotes.
+// If a string is displayed on more than one line, string concatenate
+// operator '//'is used.
+
+<bitfield_data> ::= <hex_value>
+
+<opaque_data> ::= <hex_value>:<hex_value> | <hex_value>
+
+<enum_data> ::= <enum_symbol>
+
+<reference_data> ::= <object_ref_data> | <data_region_data> | <attribute_data> | NULL
+
+<object_ref_data> ::= <object_type> <object_ref>
+
+<object_type> ::= ATTRIBUTE | DATASET | GROUP | DATATYPE
+
+<object_ref> ::= <object_id>
+
+<object_id> ::= <path_name> | OBJECTID { <object_num> }
+
+<object_num> ::= <int_value>:<int_value> | <int_value>
+
+<attribute_data> ::= ATTRIBUTE <attr_name>opt
+ <data>opt
+
+<data_region_data> ::= DATASET <dataset_name> {
+ <data_region_type>opt <data_region_data_list>
+ <dataset_type>opt <dataset_space>opt
+ <data>opt
+ }
+
+<data_region_type> ::= REGION_TYPE <data_region_data_type>
+
+<data_region_data_type> ::= POINT | BLOCK
+
+<data_region_data_list> ::= <data_region_data_info>, <data_region_data_list> |
+ <data_region_data_info>
+
+<data_region_data_info> ::= <region_info> | <point_info>
+
+<region_info> ::= (<lower_region_vals>)-(<upper_region_vals>)
+
+<lower_region_vals> ::= <lower_bound>, <lower_region_vals> | <lower_bound>
+
+<upper_region_vals> ::= <upper_bound>, <upper_region_vals> | <upper_bound>
+
+<lower_bound> ::= <int_value>
+
+<upper_bound> ::= <int_value>
+
+<point_info> ::= (<point_vals>)
+
+<point_vals> ::= <int_value> | <int_value>, <point_vals>
+
+<compound_element> ::= { <any_data_seq> }
+
+<atomic_simple_data> :: = <atomic_element>, <atomic_simple_data> |
+ <atomic_element>
+
+<simple_space_data> :: = <any_data_seq>
+
+<variable_length_element> ::= ( <any_data_seq> )
+
+<array_element> ::= '[' <any_data_seq> ']'
+
+<named_datatype> ::= DATATYPE <type_name> { <datatype> }
+
+<type_name> ::= <identifier>
+
+<hardlink> ::= HARDLINK <path_name>
+
+<group> ::= GROUP <group_name> { <hardlink> | <group_info> }
+
+<group_comment> ::= COMMENT <string_data>
+
+<group_name> ::= <identifier>
+
+<group_info> ::= <object_id>opt <group_comment>opt <group_attribute>*
+ <group_member>*
+
+<group_attribute> ::= <attribute>
+
+<group_member> ::= <named_datatype> | <group> | <dataset> |
+ <softlink> | <external_link>
+
+<dataset> ::= DATASET <dataset_name> { <hardlink> | <dataset_info> }
+
+<dataset_info> ::= <dataset_type>
+ <dataset_space>
+ <dcpl_info>opt
+ <dataset_attribute>* <object_id>opt
+ <data>opt
+// Tokens above can be in any order as long as <data> is
+// after <dataset_type> and <dataset_space>.
+
+<dcpl_info> ::= <storagelayout>
+ <compression_filters>
+ <fillvalue>
+ <allocationtime>
+
+<dataset_name> ::= <identifier>
+
+<storagelayout> :: = STORAGE_LAYOUT {
+ <contiguous_layout> | <chunked_layout> |
+ <compact_layout> | <virtual_layout>
+ }
+
+<contiguous_layout> ::= CONTIGUOUS
+ <internal_layout> | <external_layout>
+
+<chunked_layout> ::= CHUNKED <dims>
+ <filter_ratio>opt
+
+<compact_layout> ::= COMPACT
+ <size>
+
+<internal_layout> ::= <size>
+ <offset>
+
+<external_layout> ::= EXTERNAL {
+ <external_file>+
+ }
+
+<virtual_layout> ::= <vmaps>*opt
+
+<vmaps> ::= MAPPING <int_value> {
+ <virtual_map>
+ <source_map>
+ }
+
+<virtual_map> ::= VIRTUAL {
+ <vmaps_selection>
+ }
+
+<source_map> ::= SOURCE {
+ FILE <file_name>
+ DATASET <dataset_name>
+ <vmaps_selection>
+ }
+
+<vmaps_selection> ::= <regular_hyperslab> | <irregular_hyperslab> |
+ <select_points> | <select_none> | <select_all>
+
+<regular_hyperslab> ::= SELECTION REGULAR_HYPERSLAB {
+ <start>
+ <stride>
+ <count>
+ <block>
+ }
+
+<irregular_hyperslab> ::= SELECTION IRREGULAR_HYPERSLAB {
+ <region_info>+
+ }
+
+<select_points> ::= SELECTION POINT {
+ (<coor_list>)+
+ }
+
+<select_none> ::= SELECTION NONE
+
+<select_all> ::= SELECTION ALL
+
+<dims> ::= (<dims_values>)
+
+<dims_values> ::= <int_value> | <int_value>, <dims_values>
+
+<external_file> ::= FILENAME <file_name> <size> <offset>
+
+<offset> ::= OFFSET <int_value>
+
+<size> ::= SIZE <int_value>
+
+<filter_ratio> ::= <size> | <compressionratio>
+
+<compressionratio> :: = <size> (<float_data>:1 COMPRESSION)
+
+<compression_filters> :: = FILTERS {
+ <filter_type>+ | NONE
+ }
+
+<filter_type> :: = <filter_deflate> | <filter_shuffle> |
+ <filter_flecther> | <filter_szip> |
+ <filter_nbit> | <filter_scaleoffset> |
+ <filter_default>
+
+<filter_default> :: = <filter_user> {
+ FILTER_ID <int_value>
+ <filter_comment>opt
+ <filter_params>opt
+ }
+
+<filter_user> :: = USER_DEFINED_FILTER
+
+<filter_deflate> :: = COMPRESSION DEFLATE { LEVEL <int_value> }
+
+<filter_shuffle> :: = PREPROCESSING SHUFFLE
+
+<filter_flecther> :: = CHECKSUM FLETCHER32
+
+<filter_szip> :: = COMPRESSION SZIP {
+ PIXELS_PER_BLOCK <int_value>
+ <filter_szip_mode>opt
+ <filter_szip_coding>opt
+ <filter_szip_order>opt
+ <filter_szip_header>opt
+ }
+
+<filter_szip_mode> :: = MODE HARDWARE | K13
+
+<filter_szip_coding> :: = CODING ENTROPY | NEAREST NEIGHBOUR
+
+<filter_szip_order> :: = BYTE_ORDER LSB | MSB
+
+<filter_szip_header> :: = HEADER RAW
+
+<filter_nbit> :: = CHECKSUM NBIT
+
+<filter_scaleoffset> :: = COMPRESSION SCALEOFFSET { MIN BITS <int_value> }
+
+<filter_comment> :: = COMMENT <identifier>
+
+<filter_params> :: = PARAMS { <int_value>* }
+
+<fillvalue> ::= FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_ALLOC | H5D_FILL_TIME_NEVER | H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_UNDEFINED | H5D_FILL_VALUE_DEFAULT | <any_element>
+ }
+
+<allocationtime> ::= ALLOCATION_TIME {
+ H5D_ALLOC_TIME_EARLY | H5D_ALLOC_TIME_INCR |
+ H5D_ALLOC_TIME_LATE
+ }
+
+<dataset_attribute> ::= <attribute>
+
+<softlink> ::= SOFTLINK <softlink_name> {
+ LINKTARGET <target>
+ }
+
+<softlink_name> ::= <identifier>
+
+<target> ::= <identifier>
+
+<external_link> ::= EXTERNAL_LINK <external_link_name> {
+ TARGETFILE <targetfile>
+ TARGETPATH <targetpath> <targetobj>opt
+ }
+
+<external_link_name> ::= <identifier>
+
+<user_defined_link> ::= USERDEFINED_LINK <external_link_name> {
+ LINKCLASS <user_link_type>
+ }
+
+<user_link_type> ::= <int_value>
+
+<targetfile> ::= <file_name>
+
+<targetpath> ::= <identifier>
+
+<targetobj> ::= <named_datatype> | <group> | <dataset>
+
+<identifier> ::= "a string"
+// character '/' should be used with care.
+
+<pos_list> ::= <pos_int>, <pos_list> | <pos_int>
+
+<int_value> ::= 0 | <pos_int>
+
+<pos_int> ::= [1-9][0-9]*
+
+<hex_value> ::= 0x[0-F][0-F]+ | [0-F][0-F]+
+\endcode
+
+\section example114 An Example of an HDF5 File in DDL
+
+\code{.unparsed}
+HDF5 "example.h5" {
+GROUP "/" {
+ ATTRIBUTE "attr1" {
+ DATATYPE H5T_STRING {
+ STRSIZE 17;
+ STRPAD H5T_STR_NULLTERM;
+ CSET H5T_CSET_ASCII;
+ CTYPE H5T_C_S1;
+ }
+ DATASPACE SCALAR
+ DATA {
+ "string attribute"
+ }
+ }
+ DATASET "dset1" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 10, 10 ) / ( 10, 10 ) }
+ DATA {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
+ }
+ }
+ DATASET "dset2" {
+ DATATYPE H5T_COMPOUND {
+ H5T_STD_I32BE "a";
+ H5T_IEEE_F32BE "b";
+ H5T_IEEE_F64BE "c";
+ }
+ DATASPACE SIMPLE { ( 5 ) / ( 5 ) }
+ DATA {
+ {
+ 1,
+ 0.1,
+ 0.01
+ },
+ {
+ 2,
+ 0.2,
+ 0.02
+ },
+ {
+ 3,
+ 0.3,
+ 0.03
+ },
+ {
+ 4,
+ 0.4,
+ 0.04
+ },
+ {
+ 5,
+ 0.5,
+ 0.05
+ }
+ }
+ }
+ GROUP "group1" {
+ COMMENT "This is a comment for group1";
+ DATASET "dset3" {
+ DATATYPE "/type1"
+ DATASPACE SIMPLE { ( 5 ) / ( 5 ) }
+ DATA {
+ {
+ [ 0, 1, 2, 3 ],
+ [ 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
+ 0.2, 0.2, 0.2, 0.2, 0.2, 0.2,
+ 0.3, 0.3, 0.3, 0.3, 0.3, 0.3,
+ 0.4, 0.4, 0.4, 0.4, 0.4, 0.4,
+ 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 ]
+ },
+ {
+ [ 0, 1, 2, 3 ],
+ [ 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
+ 0.2, 0.2, 0.2, 0.2, 0.2, 0.2,
+ 0.3, 0.3, 0.3, 0.3, 0.3, 0.3,
+ 0.4, 0.4, 0.4, 0.4, 0.4, 0.4,
+ 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 ]
+ },
+ {
+ [ 0, 1, 2, 3 ],
+ [ 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
+ 0.2, 0.2, 0.2, 0.2, 0.2, 0.2,
+ 0.3, 0.3, 0.3, 0.3, 0.3, 0.3,
+ 0.4, 0.4, 0.4, 0.4, 0.4, 0.4,
+ 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 ]
+ },
+ {
+ [ 0, 1, 2, 3 ],
+ [ 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
+ 0.2, 0.2, 0.2, 0.2, 0.2, 0.2,
+ 0.3, 0.3, 0.3, 0.3, 0.3, 0.3,
+ 0.4, 0.4, 0.4, 0.4, 0.4, 0.4,
+ 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 ]
+ },
+ {
+ [ 0, 1, 2, 3 ],
+ [ 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
+ 0.2, 0.2, 0.2, 0.2, 0.2, 0.2,
+ 0.3, 0.3, 0.3, 0.3, 0.3, 0.3,
+ 0.4, 0.4, 0.4, 0.4, 0.4, 0.4,
+ 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 ]
+ }
+ }
+ }
+ }
+ DATASET "dset3" {
+ DATATYPE H5T_VLEN { H5T_STD_I32LE }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0), (10, 11), (20, 21, 22), (30, 31, 32, 33)
+ }
+ }
+ GROUP "group2" {
+ HARDLINK "/group1"
+ }
+ SOFTLINK "slink1" {
+ LINKTARGET "somevalue"
+ }
+ DATATYPE "type1" H5T_COMPOUND {
+ H5T_ARRAY { [4] H5T_STD_I32BE } "a";
+ H5T_ARRAY { [5][6] H5T_IEEE_F32BE } "b";
+ }
+}
+}
+\endcode
+
+*/ \ No newline at end of file
diff --git a/doxygen/dox/IntroHDF5.dox b/doxygen/dox/IntroHDF5.dox
index 2c25659..afe534b 100644
--- a/doxygen/dox/IntroHDF5.dox
+++ b/doxygen/dox/IntroHDF5.dox
@@ -204,7 +204,7 @@ Useful tools for working with HDF5 files include:
\li HDFView: A java browser to view HDF (HDF4 and HDF5) files
<h4>h5dump</h4>
-The h5dump utility displays the contents of an HDF5 file in Data Description Language (\ref DDLBNF110).
+The h5dump utility displays the contents of an HDF5 file in Data Description Language (\ref DDLBNF114).
Below is an example of h5dump output for an HDF5 file that contains no objects:
\code
$ h5dump file.h5
diff --git a/doxygen/dox/LearnBasics1.dox b/doxygen/dox/LearnBasics1.dox
index 53c8e0a..d4aa35d 100644
--- a/doxygen/dox/LearnBasics1.dox
+++ b/doxygen/dox/LearnBasics1.dox
@@ -345,7 +345,7 @@ inadvertently left open. A File Access property controls how the file is closed.
The HDF Group has developed tools for examining the contents of HDF5 files. The tool used throughout the HDF5 tutorial
is the HDF5 dumper, <code style="background-color:whitesmoke;">h5dump</code>, which displays the file contents in human-readable form. The output of <code style="background-color:whitesmoke;">h5dump</code> is an ASCII
display formatted according to the HDF5 DDL grammar. This grammar is defined, using Backus-Naur Form, in the
-\ref DDLBNF110.
+\ref DDLBNF114.
To view the HDF5 file contents, simply type:
\code
@@ -373,7 +373,7 @@ HDF5 "file.h5" {
\subsection subsecLBFileExampleDDL File Definition in DDL
The simplified DDL file definition for creating an HDF5 file. For simplicity, a simplified DDL is used in this tutorial. A
-complete and more rigorous DDL can be found in the \ref DDLBNF110.
+complete and more rigorous DDL can be found in the \ref DDLBNF114.
The following symbol definitions are used in the DDL:
\code
diff --git a/doxygen/dox/LearnBasics2.dox b/doxygen/dox/LearnBasics2.dox
index f436a02..ed2810c 100644
--- a/doxygen/dox/LearnBasics2.dox
+++ b/doxygen/dox/LearnBasics2.dox
@@ -626,6 +626,11 @@ into a long integer buffer.)
<th span="3"><strong>Float</strong></th>
</tr>
<tr>
+<td>_Float16</td>
+<td>#H5T_NATIVE_FLOAT16</td>
+<td>#H5T_IEEE_F16BE or #H5T_IEEE_F16LE</td>
+</tr>
+<tr>
<td>float</td>
<td>#H5T_NATIVE_FLOAT</td>
<td>#H5T_IEEE_F32BE or #H5T_IEEE_F32LE</td>
diff --git a/doxygen/dox/Specifications.dox b/doxygen/dox/Specifications.dox
index e352f40..42f06d2 100644
--- a/doxygen/dox/Specifications.dox
+++ b/doxygen/dox/Specifications.dox
@@ -4,6 +4,7 @@
\li \ref DDLBNF110
\li \ref DDLBNF112
+\li \ref DDLBNF114
\section File Format
diff --git a/doxygen/examples/tables/predefinedDatatypes.dox b/doxygen/examples/tables/predefinedDatatypes.dox
index 2427d0c..6cf044a 100644
--- a/doxygen/examples/tables/predefinedDatatypes.dox
+++ b/doxygen/examples/tables/predefinedDatatypes.dox
@@ -8,6 +8,14 @@
<th>Description</th>
</tr>
<tr>
+<td>#H5T_IEEE_F16BE</td>
+<td>16-bit big-endian IEEE floating point</td>
+</tr>
+<tr>
+<td>#H5T_IEEE_F16LE</td>
+<td>16-bit little-endian IEEE floating point</td>
+</tr>
+<tr>
<td>#H5T_IEEE_F32BE</td>
<td>32-bit big-endian IEEE floating point</td>
</tr>
@@ -465,6 +473,10 @@
<td>C-style unsigned long long</td>
</tr>
<tr>
+<td>#H5T_NATIVE_FLOAT16</td>
+<td>C-style _Float16 (May be H5I_INVALID_HID if platform doesn't support _Float16 type)</td>
+</tr>
+<tr>
<td>#H5T_NATIVE_FLOAT</td>
<td>C-style float</td>
</tr>
diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c
index 099356f..7d44792 100644
--- a/hl/src/H5LT.c
+++ b/hl/src/H5LT.c
@@ -2287,7 +2287,13 @@ H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *slen, bo
break;
case H5T_FLOAT:
- if (H5Tequal(dtype, H5T_IEEE_F32BE)) {
+ if (H5Tequal(dtype, H5T_IEEE_F16BE)) {
+ snprintf(dt_str, *slen, "H5T_IEEE_F16BE");
+ }
+ else if (H5Tequal(dtype, H5T_IEEE_F16LE)) {
+ snprintf(dt_str, *slen, "H5T_IEEE_F16LE");
+ }
+ else if (H5Tequal(dtype, H5T_IEEE_F32BE)) {
snprintf(dt_str, *slen, "H5T_IEEE_F32BE");
}
else if (H5Tequal(dtype, H5T_IEEE_F32LE)) {
@@ -2299,6 +2305,11 @@ H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *slen, bo
else if (H5Tequal(dtype, H5T_IEEE_F64LE)) {
snprintf(dt_str, *slen, "H5T_IEEE_F64LE");
}
+#ifdef H5_HAVE__FLOAT16
+ else if (H5Tequal(dtype, H5T_NATIVE_FLOAT16)) {
+ snprintf(dt_str, *slen, "H5T_NATIVE_FLOAT16");
+ }
+#endif
else if (H5Tequal(dtype, H5T_NATIVE_FLOAT)) {
snprintf(dt_str, *slen, "H5T_NATIVE_FLOAT");
}
diff --git a/hl/src/H5LTanalyze.c b/hl/src/H5LTanalyze.c
index 8890b8e..3e6b20d 100644
--- a/hl/src/H5LTanalyze.c
+++ b/hl/src/H5LTanalyze.c
@@ -29,14 +29,14 @@
#elif defined _MSC_VER
#pragma warning(push, 1)
#endif
-#line 2 "hl/src//H5LTanalyze.c"
+#line 1 "hl/src//H5LTanalyze.c"
/* Quiet warnings about integer type macro redefinitions on Visual Studio
* (MSVC doesn't define STDC_VERSION, but has inttypes.h). This is an
* issue that is apparently fixed in flex 2.6.5.
*/
#include <stdint.h>
-#line 9 "hl/src//H5LTanalyze.c"
+#line 8 "hl/src//H5LTanalyze.c"
#define YY_INT_ALIGNED short int
@@ -647,8 +647,8 @@ static void yynoreturn yy_fatal_error ( const char* msg );
(yy_hold_char) = *yy_cp; \
*yy_cp = '\0'; \
(yy_c_buf_p) = yy_cp;
-#define YY_NUM_RULES 64
-#define YY_END_OF_BUFFER 65
+#define YY_NUM_RULES 67
+#define YY_END_OF_BUFFER 68
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -656,38 +656,39 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static const flex_int16_t yy_accept[275] =
+static const flex_int16_t yy_accept[283] =
{ 0,
- 63, 63, 65, 64, 63, 64, 55, 61, 62, 64,
- 64, 64, 64, 59, 60, 57, 58, 63, 0, 55,
- 0, 0, 0, 0, 0, 56, 0, 0, 0, 0,
- 0, 38, 0, 0, 0, 0, 0, 39, 0, 0,
+ 66, 66, 68, 67, 66, 67, 58, 64, 65, 67,
+ 67, 67, 67, 62, 63, 60, 61, 66, 0, 58,
+ 0, 0, 0, 0, 0, 59, 0, 0, 0, 0,
+ 0, 41, 0, 0, 0, 0, 0, 42, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 37, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 40, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 54, 36, 0, 0, 0, 45, 49, 0, 0,
- 0, 0, 0, 0, 0, 0, 51, 53, 50, 0,
+ 0, 57, 39, 0, 0, 0, 48, 52, 0, 0,
+ 0, 0, 0, 0, 0, 0, 54, 56, 53, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 52, 0, 0,
- 0, 0, 0, 0, 0, 0, 35, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 55, 0, 0,
+ 0, 0, 0, 0, 0, 0, 38, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
- 2, 0, 0, 0, 0, 0, 0, 9, 10, 0,
- 0, 47, 0, 44, 0, 0, 0, 0, 0, 0,
+ 0, 51, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
- 0, 0, 3, 4, 5, 6, 7, 8, 11, 12,
- 13, 14, 15, 16, 0, 0, 0, 43, 46, 28,
- 29, 30, 31, 0, 0, 0, 22, 0, 0, 0,
+ 0, 1, 2, 0, 0, 0, 0, 0, 0, 9,
+ 10, 0, 0, 50, 0, 47, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 17, 0, 0, 0, 0, 24, 0, 0, 0, 23,
- 0, 0, 0, 41, 0, 0, 0, 32, 0, 26,
- 18, 20, 19, 0, 25, 0, 40, 42, 33, 0,
- 27, 21, 34, 0
+
+ 0, 0, 0, 0, 0, 0, 3, 4, 5, 6,
+ 7, 8, 11, 12, 13, 14, 15, 16, 0, 0,
+ 0, 46, 49, 28, 29, 30, 31, 32, 33, 0,
+ 0, 0, 22, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 17, 0, 0, 0,
+ 0, 24, 0, 0, 0, 23, 0, 0, 0, 44,
+ 0, 0, 0, 35, 0, 26, 18, 20, 19, 0,
+ 25, 0, 43, 45, 36, 0, 0, 27, 21, 34,
+ 37, 0
} ;
static const YY_CHAR yy_ec[256] =
@@ -730,75 +731,77 @@ static const YY_CHAR yy_meta[41] =
1, 1, 1, 1, 1, 1, 1, 1, 1, 1
} ;
-static const flex_int16_t yy_base[277] =
+static const flex_int16_t yy_base[285] =
{ 0,
- 0, 0, 299, 300, 296, 0, 0, 300, 300, 11,
- 288, 269, 264, 300, 300, 300, 300, 292, 290, 0,
- 274, 257, 259, 261, 259, 300, 256, 259, 247, 246,
- 16, 300, 265, 33, 14, 268, 259, 300, 251, 24,
- 254, 252, 259, 262, 248, 243, 34, 251, 258, 254,
- 235, 240, 244, 249, 236, 233, 235, 245, 231, 247,
- 36, 231, 241, 223, 237, 300, 238, 241, 227, 222,
- 247, 227, 219, 231, 226, 219, 208, 34, 223, 219,
- 225, 300, 300, 208, 215, 202, 300, 300, 210, 200,
- 204, 204, 38, 210, 39, 220, 300, 300, 300, 201,
-
- 47, 218, 212, 212, 211, 66, 73, 208, 195, 199,
- 210, 199, 193, 191, 196, 75, 182, 300, 209, 212,
- 209, 52, 206, 209, 206, 66, 300, 190, 198, 188,
- 193, 193, 189, 169, 200, 197, 74, 71, 72, 77,
- 186, 185, 84, 86, 87, 184, 183, 177, 183, 180,
- 300, 175, 185, 165, 88, 90, 173, 167, 169, 166,
- 91, 99, 96, 172, 171, 170, 169, 168, 167, 300,
- 300, 166, 165, 164, 163, 162, 161, 300, 300, 94,
- 160, 300, 155, 300, 171, 157, 156, 155, 154, 157,
- 138, 143, 137, 141, 140, 140, 143, 137, 141, 136,
-
- 101, 139, 300, 300, 300, 300, 300, 300, 300, 300,
- 300, 300, 300, 300, 145, 140, 130, 300, 300, 300,
- 300, 300, 300, 127, 140, 140, 300, 121, 127, 131,
- 136, 120, 134, 116, 120, 120, 118, 126, 113, 127,
- 300, 117, 108, 123, 117, 300, 107, 104, 105, 300,
- 108, 112, 102, 300, 105, 106, 104, 300, 93, 300,
- 300, 300, 300, 78, 300, 57, 300, 300, 300, 56,
- 300, 300, 300, 300, 127, 65
+ 0, 0, 307, 308, 304, 0, 0, 308, 308, 11,
+ 296, 277, 272, 308, 308, 308, 308, 300, 298, 0,
+ 282, 265, 267, 269, 267, 308, 264, 267, 255, 254,
+ 16, 308, 273, 33, 14, 276, 267, 308, 259, 24,
+ 262, 260, 267, 270, 256, 251, 34, 259, 266, 262,
+ 243, 248, 252, 257, 244, 241, 243, 253, 239, 255,
+ 36, 239, 249, 231, 245, 308, 246, 249, 235, 230,
+ 255, 235, 227, 239, 234, 227, 216, 34, 231, 227,
+ 233, 308, 308, 216, 223, 210, 308, 308, 218, 208,
+ 212, 212, 38, 218, 39, 228, 308, 308, 308, 209,
+
+ 47, 226, 220, 220, 219, 66, 73, 216, 203, 207,
+ 218, 207, 201, 199, 204, 80, 190, 308, 217, 220,
+ 217, 52, 214, 217, 214, 59, 308, 198, 206, 196,
+ 201, 201, 197, 177, 204, 207, 204, 75, 66, 73,
+ 78, 193, 192, 80, 85, 87, 191, 190, 184, 190,
+ 187, 308, 182, 192, 172, 89, 91, 94, 180, 174,
+ 176, 173, 96, 95, 102, 179, 178, 177, 176, 175,
+ 174, 308, 308, 173, 172, 171, 170, 169, 168, 308,
+ 308, 96, 167, 308, 162, 308, 178, 164, 163, 162,
+ 161, 160, 159, 162, 143, 148, 142, 146, 145, 145,
+
+ 148, 142, 146, 141, 103, 144, 308, 308, 308, 308,
+ 308, 308, 308, 308, 308, 308, 308, 308, 150, 145,
+ 135, 308, 308, 308, 308, 308, 308, 308, 308, 132,
+ 145, 145, 308, 126, 132, 136, 141, 125, 139, 121,
+ 125, 125, 123, 131, 118, 132, 308, 122, 113, 128,
+ 122, 308, 112, 109, 110, 308, 113, 117, 107, 308,
+ 110, 114, 112, 123, 98, 308, 308, 308, 308, 100,
+ 308, 84, 308, 308, 308, 89, 68, 308, 308, 308,
+ 308, 308, 132, 65
} ;
-static const flex_int16_t yy_def[277] =
+static const flex_int16_t yy_def[285] =
{ 0,
- 274, 1, 274, 274, 274, 275, 276, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 275, 276,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
-
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
-
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 0, 274, 274
+ 282, 1, 282, 282, 282, 283, 284, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 283, 284,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 0, 282, 282
} ;
-static const flex_int16_t yy_nxt[341] =
+static const flex_int16_t yy_nxt[349] =
{ 0,
4, 5, 6, 7, 7, 7, 7, 7, 7, 7,
7, 8, 9, 4, 4, 10, 4, 4, 4, 4,
@@ -806,40 +809,41 @@ static const flex_int16_t yy_nxt[341] =
4, 4, 4, 4, 4, 14, 15, 4, 16, 17,
21, 22, 36, 48, 49, 37, 39, 62, 40, 53,
41, 42, 77, 54, 43, 94, 63, 44, 45, 106,
- 113, 55, 46, 109, 78, 47, 141, 20, 110, 107,
- 119, 95, 120, 273, 142, 121, 122, 123, 114, 124,
- 146, 135, 125, 126, 136, 164, 166, 272, 147, 157,
- 158, 168, 159, 165, 167, 160, 161, 271, 172, 169,
-
- 174, 176, 186, 162, 188, 163, 173, 194, 175, 177,
- 187, 199, 189, 195, 197, 270, 196, 200, 201, 198,
- 215, 269, 268, 235, 216, 202, 236, 19, 267, 19,
- 266, 265, 264, 263, 262, 261, 260, 259, 258, 257,
- 256, 255, 254, 253, 252, 251, 250, 249, 248, 247,
- 246, 245, 244, 243, 242, 241, 240, 239, 238, 237,
- 234, 233, 232, 231, 230, 229, 228, 227, 226, 225,
- 224, 223, 222, 221, 220, 219, 218, 217, 214, 213,
- 212, 211, 210, 209, 208, 207, 206, 205, 204, 203,
- 193, 192, 191, 190, 185, 184, 183, 182, 181, 180,
-
- 179, 178, 171, 170, 156, 155, 154, 153, 152, 151,
- 150, 149, 148, 145, 144, 143, 140, 139, 138, 137,
- 134, 133, 132, 131, 130, 129, 128, 127, 118, 117,
- 116, 115, 112, 111, 108, 105, 104, 103, 102, 101,
- 100, 99, 98, 97, 96, 93, 92, 91, 90, 89,
- 88, 87, 86, 85, 84, 83, 82, 81, 80, 79,
- 76, 75, 74, 73, 72, 71, 70, 69, 68, 67,
- 66, 65, 64, 61, 60, 59, 58, 57, 56, 52,
- 51, 50, 38, 35, 34, 33, 32, 31, 30, 29,
- 28, 27, 26, 18, 25, 24, 23, 18, 274, 3,
-
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274
+ 113, 55, 46, 109, 78, 47, 142, 20, 110, 107,
+ 119, 95, 120, 147, 143, 121, 122, 123, 114, 124,
+ 166, 148, 125, 126, 135, 281, 136, 168, 167, 137,
+ 159, 160, 170, 161, 174, 169, 162, 163, 280, 176,
+
+ 171, 178, 175, 188, 164, 190, 165, 177, 192, 179,
+ 201, 189, 198, 191, 279, 202, 193, 203, 199, 278,
+ 277, 200, 219, 204, 205, 241, 220, 276, 242, 275,
+ 274, 206, 19, 273, 19, 272, 271, 270, 269, 268,
+ 267, 266, 265, 264, 263, 262, 261, 260, 259, 258,
+ 257, 256, 255, 254, 253, 252, 251, 250, 249, 248,
+ 247, 246, 245, 244, 243, 240, 239, 238, 237, 236,
+ 235, 234, 233, 232, 231, 230, 229, 228, 227, 226,
+ 225, 224, 223, 222, 221, 218, 217, 216, 215, 214,
+ 213, 212, 211, 210, 209, 208, 207, 197, 196, 195,
+
+ 194, 187, 186, 185, 184, 183, 182, 181, 180, 173,
+ 172, 158, 157, 156, 155, 154, 153, 152, 151, 150,
+ 149, 146, 145, 144, 141, 140, 139, 138, 134, 133,
+ 132, 131, 130, 129, 128, 127, 118, 117, 116, 115,
+ 112, 111, 108, 105, 104, 103, 102, 101, 100, 99,
+ 98, 97, 96, 93, 92, 91, 90, 89, 88, 87,
+ 86, 85, 84, 83, 82, 81, 80, 79, 76, 75,
+ 74, 73, 72, 71, 70, 69, 68, 67, 66, 65,
+ 64, 61, 60, 59, 58, 57, 56, 52, 51, 50,
+ 38, 35, 34, 33, 32, 31, 30, 29, 28, 27,
+
+ 26, 18, 25, 24, 23, 18, 282, 3, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282
} ;
-static const flex_int16_t yy_chk[341] =
+static const flex_int16_t yy_chk[349] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -847,37 +851,38 @@ static const flex_int16_t yy_chk[341] =
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
10, 10, 31, 35, 35, 31, 34, 47, 34, 40,
34, 34, 61, 40, 34, 78, 47, 34, 34, 93,
- 101, 40, 34, 95, 61, 34, 122, 276, 95, 93,
- 106, 78, 106, 270, 122, 106, 106, 107, 101, 107,
- 126, 116, 107, 107, 116, 138, 139, 266, 126, 137,
- 137, 140, 137, 138, 139, 137, 137, 264, 143, 140,
-
- 144, 145, 155, 137, 156, 137, 143, 161, 144, 145,
- 155, 163, 156, 161, 162, 259, 161, 163, 163, 162,
- 180, 257, 256, 201, 180, 163, 201, 275, 255, 275,
- 253, 252, 251, 249, 248, 247, 245, 244, 243, 242,
- 240, 239, 238, 237, 236, 235, 234, 233, 232, 231,
- 230, 229, 228, 226, 225, 224, 217, 216, 215, 202,
- 200, 199, 198, 197, 196, 195, 194, 193, 192, 191,
- 190, 189, 188, 187, 186, 185, 183, 181, 177, 176,
- 175, 174, 173, 172, 169, 168, 167, 166, 165, 164,
- 160, 159, 158, 157, 154, 153, 152, 150, 149, 148,
-
- 147, 146, 142, 141, 136, 135, 134, 133, 132, 131,
- 130, 129, 128, 125, 124, 123, 121, 120, 119, 117,
- 115, 114, 113, 112, 111, 110, 109, 108, 105, 104,
- 103, 102, 100, 96, 94, 92, 91, 90, 89, 86,
- 85, 84, 81, 80, 79, 77, 76, 75, 74, 73,
- 72, 71, 70, 69, 68, 67, 65, 64, 63, 62,
- 60, 59, 58, 57, 56, 55, 54, 53, 52, 51,
- 50, 49, 48, 46, 45, 44, 43, 42, 41, 39,
- 37, 36, 33, 30, 29, 28, 27, 25, 24, 23,
- 22, 21, 19, 18, 13, 12, 11, 5, 3, 274,
-
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
- 274, 274, 274, 274, 274, 274, 274, 274, 274, 274
+ 101, 40, 34, 95, 61, 34, 122, 284, 95, 93,
+ 106, 78, 106, 126, 122, 106, 106, 107, 101, 107,
+ 139, 126, 107, 107, 116, 277, 116, 140, 139, 116,
+ 138, 138, 141, 138, 144, 140, 138, 138, 276, 145,
+
+ 141, 146, 144, 156, 138, 157, 138, 145, 158, 146,
+ 164, 156, 163, 157, 272, 164, 158, 165, 163, 270,
+ 265, 163, 182, 165, 165, 205, 182, 264, 205, 263,
+ 262, 165, 283, 261, 283, 259, 258, 257, 255, 254,
+ 253, 251, 250, 249, 248, 246, 245, 244, 243, 242,
+ 241, 240, 239, 238, 237, 236, 235, 234, 232, 231,
+ 230, 221, 220, 219, 206, 204, 203, 202, 201, 200,
+ 199, 198, 197, 196, 195, 194, 193, 192, 191, 190,
+ 189, 188, 187, 185, 183, 179, 178, 177, 176, 175,
+ 174, 171, 170, 169, 168, 167, 166, 162, 161, 160,
+
+ 159, 155, 154, 153, 151, 150, 149, 148, 147, 143,
+ 142, 137, 136, 135, 134, 133, 132, 131, 130, 129,
+ 128, 125, 124, 123, 121, 120, 119, 117, 115, 114,
+ 113, 112, 111, 110, 109, 108, 105, 104, 103, 102,
+ 100, 96, 94, 92, 91, 90, 89, 86, 85, 84,
+ 81, 80, 79, 77, 76, 75, 74, 73, 72, 71,
+ 70, 69, 68, 67, 65, 64, 63, 62, 60, 59,
+ 58, 57, 56, 55, 54, 53, 52, 51, 50, 49,
+ 48, 46, 45, 44, 43, 42, 41, 39, 37, 36,
+ 33, 30, 29, 28, 27, 25, 24, 23, 22, 21,
+
+ 19, 18, 13, 12, 11, 5, 3, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282
} ;
static yy_state_type yy_last_accepting_state;
@@ -936,8 +941,8 @@ static int my_yyinput(char *, int);
extern char *myinput;
extern size_t input_len;
-#line 909 "hl/src//H5LTanalyze.c"
-#line 910 "hl/src//H5LTanalyze.c"
+#line 913 "hl/src//H5LTanalyze.c"
+#line 914 "hl/src//H5LTanalyze.c"
#define INITIAL 0
@@ -1149,7 +1154,7 @@ YY_DECL
#line 53 "hl/src//H5LTanalyze.l"
-#line 1122 "hl/src//H5LTanalyze.c"
+#line 1126 "hl/src//H5LTanalyze.c"
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{
@@ -1176,13 +1181,13 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 275 )
+ if ( yy_current_state >= 283 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
++yy_cp;
}
- while ( yy_base[yy_current_state] != 300 );
+ while ( yy_base[yy_current_state] != 308 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -1344,197 +1349,212 @@ YY_RULE_SETUP
case 28:
YY_RULE_SETUP
#line 85 "hl/src//H5LTanalyze.l"
-{return hid(H5T_IEEE_F32BE_TOKEN);}
+{return hid(H5T_IEEE_F16BE_TOKEN);}
YY_BREAK
case 29:
YY_RULE_SETUP
#line 86 "hl/src//H5LTanalyze.l"
-{return hid(H5T_IEEE_F32LE_TOKEN);}
+{return hid(H5T_IEEE_F16LE_TOKEN);}
YY_BREAK
case 30:
YY_RULE_SETUP
#line 87 "hl/src//H5LTanalyze.l"
-{return hid(H5T_IEEE_F64BE_TOKEN);}
+{return hid(H5T_IEEE_F32BE_TOKEN);}
YY_BREAK
case 31:
YY_RULE_SETUP
#line 88 "hl/src//H5LTanalyze.l"
-{return hid(H5T_IEEE_F64LE_TOKEN);}
+{return hid(H5T_IEEE_F32LE_TOKEN);}
YY_BREAK
case 32:
YY_RULE_SETUP
#line 89 "hl/src//H5LTanalyze.l"
-{return hid(H5T_NATIVE_FLOAT_TOKEN);}
+{return hid(H5T_IEEE_F64BE_TOKEN);}
YY_BREAK
case 33:
YY_RULE_SETUP
#line 90 "hl/src//H5LTanalyze.l"
-{return hid(H5T_NATIVE_DOUBLE_TOKEN);}
+{return hid(H5T_IEEE_F64LE_TOKEN);}
YY_BREAK
case 34:
YY_RULE_SETUP
#line 91 "hl/src//H5LTanalyze.l"
-{return hid(H5T_NATIVE_LDOUBLE_TOKEN);}
+{return hid(H5T_NATIVE_FLOAT16_TOKEN);}
YY_BREAK
case 35:
YY_RULE_SETUP
-#line 93 "hl/src//H5LTanalyze.l"
-{return token(H5T_STRING_TOKEN);}
+#line 92 "hl/src//H5LTanalyze.l"
+{return hid(H5T_NATIVE_FLOAT_TOKEN);}
YY_BREAK
case 36:
YY_RULE_SETUP
-#line 94 "hl/src//H5LTanalyze.l"
-{return token(STRSIZE_TOKEN);}
+#line 93 "hl/src//H5LTanalyze.l"
+{return hid(H5T_NATIVE_DOUBLE_TOKEN);}
YY_BREAK
case 37:
YY_RULE_SETUP
-#line 95 "hl/src//H5LTanalyze.l"
-{return token(STRPAD_TOKEN);}
+#line 94 "hl/src//H5LTanalyze.l"
+{return hid(H5T_NATIVE_LDOUBLE_TOKEN);}
YY_BREAK
case 38:
YY_RULE_SETUP
#line 96 "hl/src//H5LTanalyze.l"
-{return token(CSET_TOKEN);}
+{return token(H5T_STRING_TOKEN);}
YY_BREAK
case 39:
YY_RULE_SETUP
#line 97 "hl/src//H5LTanalyze.l"
-{return token(CTYPE_TOKEN);}
+{return token(STRSIZE_TOKEN);}
YY_BREAK
case 40:
YY_RULE_SETUP
#line 98 "hl/src//H5LTanalyze.l"
-{return token(H5T_STR_NULLTERM_TOKEN);}
+{return token(STRPAD_TOKEN);}
YY_BREAK
case 41:
YY_RULE_SETUP
#line 99 "hl/src//H5LTanalyze.l"
-{return token(H5T_STR_NULLPAD_TOKEN);}
+{return token(CSET_TOKEN);}
YY_BREAK
case 42:
YY_RULE_SETUP
#line 100 "hl/src//H5LTanalyze.l"
-{return token(H5T_STR_SPACEPAD_TOKEN);}
+{return token(CTYPE_TOKEN);}
YY_BREAK
case 43:
YY_RULE_SETUP
#line 101 "hl/src//H5LTanalyze.l"
-{return token(H5T_CSET_ASCII_TOKEN);}
+{return token(H5T_STR_NULLTERM_TOKEN);}
YY_BREAK
case 44:
YY_RULE_SETUP
#line 102 "hl/src//H5LTanalyze.l"
-{return token(H5T_CSET_UTF8_TOKEN);}
+{return token(H5T_STR_NULLPAD_TOKEN);}
YY_BREAK
case 45:
YY_RULE_SETUP
#line 103 "hl/src//H5LTanalyze.l"
-{return token(H5T_C_S1_TOKEN);}
+{return token(H5T_STR_SPACEPAD_TOKEN);}
YY_BREAK
case 46:
YY_RULE_SETUP
#line 104 "hl/src//H5LTanalyze.l"
-{return token(H5T_FORTRAN_S1_TOKEN);}
+{return token(H5T_CSET_ASCII_TOKEN);}
YY_BREAK
case 47:
YY_RULE_SETUP
#line 105 "hl/src//H5LTanalyze.l"
-{return token(H5T_VARIABLE_TOKEN);}
+{return token(H5T_CSET_UTF8_TOKEN);}
YY_BREAK
case 48:
YY_RULE_SETUP
-#line 107 "hl/src//H5LTanalyze.l"
-{return token(H5T_COMPOUND_TOKEN);}
+#line 106 "hl/src//H5LTanalyze.l"
+{return token(H5T_C_S1_TOKEN);}
YY_BREAK
case 49:
YY_RULE_SETUP
-#line 108 "hl/src//H5LTanalyze.l"
-{return token(H5T_ENUM_TOKEN);}
+#line 107 "hl/src//H5LTanalyze.l"
+{return token(H5T_FORTRAN_S1_TOKEN);}
YY_BREAK
case 50:
YY_RULE_SETUP
-#line 109 "hl/src//H5LTanalyze.l"
-{return token(H5T_ARRAY_TOKEN);}
+#line 108 "hl/src//H5LTanalyze.l"
+{return token(H5T_VARIABLE_TOKEN);}
YY_BREAK
case 51:
YY_RULE_SETUP
#line 110 "hl/src//H5LTanalyze.l"
-{return token(H5T_VLEN_TOKEN);}
+{return token(H5T_COMPOUND_TOKEN);}
YY_BREAK
case 52:
YY_RULE_SETUP
-#line 112 "hl/src//H5LTanalyze.l"
-{return token(H5T_OPAQUE_TOKEN);}
+#line 111 "hl/src//H5LTanalyze.l"
+{return token(H5T_ENUM_TOKEN);}
YY_BREAK
case 53:
YY_RULE_SETUP
-#line 113 "hl/src//H5LTanalyze.l"
-{return token(OPQ_SIZE_TOKEN);}
+#line 112 "hl/src//H5LTanalyze.l"
+{return token(H5T_ARRAY_TOKEN);}
YY_BREAK
case 54:
YY_RULE_SETUP
-#line 114 "hl/src//H5LTanalyze.l"
-{return token(OPQ_TAG_TOKEN);}
+#line 113 "hl/src//H5LTanalyze.l"
+{return token(H5T_VLEN_TOKEN);}
YY_BREAK
case 55:
YY_RULE_SETUP
+#line 115 "hl/src//H5LTanalyze.l"
+{return token(H5T_OPAQUE_TOKEN);}
+ YY_BREAK
+case 56:
+YY_RULE_SETUP
#line 116 "hl/src//H5LTanalyze.l"
+{return token(OPQ_SIZE_TOKEN);}
+ YY_BREAK
+case 57:
+YY_RULE_SETUP
+#line 117 "hl/src//H5LTanalyze.l"
+{return token(OPQ_TAG_TOKEN);}
+ YY_BREAK
+case 58:
+YY_RULE_SETUP
+#line 119 "hl/src//H5LTanalyze.l"
{
H5LTyylval.ival = atoi(yytext);
return NUMBER;
}
YY_BREAK
-case 56:
-/* rule 56 can match eol */
+case 59:
+/* rule 59 can match eol */
YY_RULE_SETUP
-#line 121 "hl/src//H5LTanalyze.l"
+#line 124 "hl/src//H5LTanalyze.l"
{
H5LTyylval.sval = trim_quotes(yytext);
return STRING;
}
YY_BREAK
-case 57:
+case 60:
YY_RULE_SETUP
-#line 126 "hl/src//H5LTanalyze.l"
+#line 129 "hl/src//H5LTanalyze.l"
{return token('{');}
YY_BREAK
-case 58:
+case 61:
YY_RULE_SETUP
-#line 127 "hl/src//H5LTanalyze.l"
+#line 130 "hl/src//H5LTanalyze.l"
{return token('}');}
YY_BREAK
-case 59:
+case 62:
YY_RULE_SETUP
-#line 128 "hl/src//H5LTanalyze.l"
+#line 131 "hl/src//H5LTanalyze.l"
{return token('[');}
YY_BREAK
-case 60:
+case 63:
YY_RULE_SETUP
-#line 129 "hl/src//H5LTanalyze.l"
+#line 132 "hl/src//H5LTanalyze.l"
{return token(']');}
YY_BREAK
-case 61:
+case 64:
YY_RULE_SETUP
-#line 130 "hl/src//H5LTanalyze.l"
+#line 133 "hl/src//H5LTanalyze.l"
{return token(':');}
YY_BREAK
-case 62:
+case 65:
YY_RULE_SETUP
-#line 131 "hl/src//H5LTanalyze.l"
+#line 134 "hl/src//H5LTanalyze.l"
{return token(';');}
YY_BREAK
-case 63:
-/* rule 63 can match eol */
+case 66:
+/* rule 66 can match eol */
YY_RULE_SETUP
-#line 132 "hl/src//H5LTanalyze.l"
+#line 135 "hl/src//H5LTanalyze.l"
;
YY_BREAK
-case 64:
+case 67:
YY_RULE_SETUP
-#line 134 "hl/src//H5LTanalyze.l"
+#line 137 "hl/src//H5LTanalyze.l"
ECHO;
YY_BREAK
-#line 1507 "hl/src//H5LTanalyze.c"
+#line 1526 "hl/src//H5LTanalyze.c"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1831,7 +1851,7 @@ static int yy_get_next_buffer (void)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 275 )
+ if ( yy_current_state >= 283 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
@@ -1859,11 +1879,11 @@ static int yy_get_next_buffer (void)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 275 )
+ if ( yy_current_state >= 283 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
- yy_is_jam = (yy_current_state == 274);
+ yy_is_jam = (yy_current_state == 282);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -2539,7 +2559,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 134 "hl/src//H5LTanalyze.l"
+#line 137 "hl/src//H5LTanalyze.l"
/* Allocate a copy of `quoted` with the double quote character at
diff --git a/hl/src/H5LTanalyze.l b/hl/src/H5LTanalyze.l
index 58a6636..a573f81 100644
--- a/hl/src/H5LTanalyze.l
+++ b/hl/src/H5LTanalyze.l
@@ -82,10 +82,13 @@ H5T_NATIVE_ULONG {return hid(H5T_NATIVE_ULONG_TOKEN);}
H5T_NATIVE_LLONG {return hid(H5T_NATIVE_LLONG_TOKEN);}
H5T_NATIVE_ULLONG {return hid(H5T_NATIVE_ULLONG_TOKEN);}
+H5T_IEEE_F16BE {return hid(H5T_IEEE_F16BE_TOKEN);}
+H5T_IEEE_F16LE {return hid(H5T_IEEE_F16LE_TOKEN);}
H5T_IEEE_F32BE {return hid(H5T_IEEE_F32BE_TOKEN);}
H5T_IEEE_F32LE {return hid(H5T_IEEE_F32LE_TOKEN);}
H5T_IEEE_F64BE {return hid(H5T_IEEE_F64BE_TOKEN);}
H5T_IEEE_F64LE {return hid(H5T_IEEE_F64LE_TOKEN);}
+H5T_NATIVE_FLOAT16 {return hid(H5T_NATIVE_FLOAT16_TOKEN);}
H5T_NATIVE_FLOAT {return hid(H5T_NATIVE_FLOAT_TOKEN);}
H5T_NATIVE_DOUBLE {return hid(H5T_NATIVE_DOUBLE_TOKEN);}
H5T_NATIVE_LDOUBLE {return hid(H5T_NATIVE_LDOUBLE_TOKEN);}
diff --git a/hl/src/H5LTparse.c b/hl/src/H5LTparse.c
index 592b863..bb71376 100644
--- a/hl/src/H5LTparse.c
+++ b/hl/src/H5LTparse.c
@@ -213,84 +213,87 @@ enum yysymbol_kind_t
YYSYMBOL_H5T_NATIVE_ULONG_TOKEN = 27, /* H5T_NATIVE_ULONG_TOKEN */
YYSYMBOL_H5T_NATIVE_LLONG_TOKEN = 28, /* H5T_NATIVE_LLONG_TOKEN */
YYSYMBOL_H5T_NATIVE_ULLONG_TOKEN = 29, /* H5T_NATIVE_ULLONG_TOKEN */
- YYSYMBOL_H5T_IEEE_F32BE_TOKEN = 30, /* H5T_IEEE_F32BE_TOKEN */
- YYSYMBOL_H5T_IEEE_F32LE_TOKEN = 31, /* H5T_IEEE_F32LE_TOKEN */
- YYSYMBOL_H5T_IEEE_F64BE_TOKEN = 32, /* H5T_IEEE_F64BE_TOKEN */
- YYSYMBOL_H5T_IEEE_F64LE_TOKEN = 33, /* H5T_IEEE_F64LE_TOKEN */
- YYSYMBOL_H5T_NATIVE_FLOAT_TOKEN = 34, /* H5T_NATIVE_FLOAT_TOKEN */
- YYSYMBOL_H5T_NATIVE_DOUBLE_TOKEN = 35, /* H5T_NATIVE_DOUBLE_TOKEN */
- YYSYMBOL_H5T_NATIVE_LDOUBLE_TOKEN = 36, /* H5T_NATIVE_LDOUBLE_TOKEN */
- YYSYMBOL_H5T_STRING_TOKEN = 37, /* H5T_STRING_TOKEN */
- YYSYMBOL_STRSIZE_TOKEN = 38, /* STRSIZE_TOKEN */
- YYSYMBOL_STRPAD_TOKEN = 39, /* STRPAD_TOKEN */
- YYSYMBOL_CSET_TOKEN = 40, /* CSET_TOKEN */
- YYSYMBOL_CTYPE_TOKEN = 41, /* CTYPE_TOKEN */
- YYSYMBOL_H5T_VARIABLE_TOKEN = 42, /* H5T_VARIABLE_TOKEN */
- YYSYMBOL_H5T_STR_NULLTERM_TOKEN = 43, /* H5T_STR_NULLTERM_TOKEN */
- YYSYMBOL_H5T_STR_NULLPAD_TOKEN = 44, /* H5T_STR_NULLPAD_TOKEN */
- YYSYMBOL_H5T_STR_SPACEPAD_TOKEN = 45, /* H5T_STR_SPACEPAD_TOKEN */
- YYSYMBOL_H5T_CSET_ASCII_TOKEN = 46, /* H5T_CSET_ASCII_TOKEN */
- YYSYMBOL_H5T_CSET_UTF8_TOKEN = 47, /* H5T_CSET_UTF8_TOKEN */
- YYSYMBOL_H5T_C_S1_TOKEN = 48, /* H5T_C_S1_TOKEN */
- YYSYMBOL_H5T_FORTRAN_S1_TOKEN = 49, /* H5T_FORTRAN_S1_TOKEN */
- YYSYMBOL_H5T_OPAQUE_TOKEN = 50, /* H5T_OPAQUE_TOKEN */
- YYSYMBOL_OPQ_SIZE_TOKEN = 51, /* OPQ_SIZE_TOKEN */
- YYSYMBOL_OPQ_TAG_TOKEN = 52, /* OPQ_TAG_TOKEN */
- YYSYMBOL_H5T_COMPOUND_TOKEN = 53, /* H5T_COMPOUND_TOKEN */
- YYSYMBOL_H5T_ENUM_TOKEN = 54, /* H5T_ENUM_TOKEN */
- YYSYMBOL_H5T_ARRAY_TOKEN = 55, /* H5T_ARRAY_TOKEN */
- YYSYMBOL_H5T_VLEN_TOKEN = 56, /* H5T_VLEN_TOKEN */
- YYSYMBOL_STRING = 57, /* STRING */
- YYSYMBOL_NUMBER = 58, /* NUMBER */
- YYSYMBOL_59_ = 59, /* '{' */
- YYSYMBOL_60_ = 60, /* '}' */
- YYSYMBOL_61_ = 61, /* '[' */
- YYSYMBOL_62_ = 62, /* ']' */
- YYSYMBOL_63_ = 63, /* ':' */
- YYSYMBOL_64_ = 64, /* ';' */
- YYSYMBOL_YYACCEPT = 65, /* $accept */
- YYSYMBOL_start = 66, /* start */
- YYSYMBOL_ddl_type = 67, /* ddl_type */
- YYSYMBOL_atomic_type = 68, /* atomic_type */
- YYSYMBOL_integer_type = 69, /* integer_type */
- YYSYMBOL_fp_type = 70, /* fp_type */
- YYSYMBOL_compound_type = 71, /* compound_type */
- YYSYMBOL_72_1 = 72, /* $@1 */
- YYSYMBOL_memb_list = 73, /* memb_list */
- YYSYMBOL_memb_def = 74, /* memb_def */
- YYSYMBOL_75_2 = 75, /* $@2 */
- YYSYMBOL_field_name = 76, /* field_name */
- YYSYMBOL_field_offset = 77, /* field_offset */
- YYSYMBOL_offset = 78, /* offset */
- YYSYMBOL_array_type = 79, /* array_type */
- YYSYMBOL_80_3 = 80, /* $@3 */
- YYSYMBOL_dim_list = 81, /* dim_list */
- YYSYMBOL_dim = 82, /* dim */
- YYSYMBOL_83_4 = 83, /* $@4 */
- YYSYMBOL_84_5 = 84, /* $@5 */
- YYSYMBOL_dimsize = 85, /* dimsize */
- YYSYMBOL_vlen_type = 86, /* vlen_type */
- YYSYMBOL_opaque_type = 87, /* opaque_type */
- YYSYMBOL_88_6 = 88, /* @6 */
- YYSYMBOL_89_7 = 89, /* $@7 */
- YYSYMBOL_opaque_size = 90, /* opaque_size */
- YYSYMBOL_opaque_tag = 91, /* opaque_tag */
- YYSYMBOL_string_type = 92, /* string_type */
- YYSYMBOL_93_8 = 93, /* $@8 */
- YYSYMBOL_94_9 = 94, /* $@9 */
- YYSYMBOL_95_10 = 95, /* $@10 */
- YYSYMBOL_96_11 = 96, /* @11 */
- YYSYMBOL_strsize = 97, /* strsize */
- YYSYMBOL_strpad = 98, /* strpad */
- YYSYMBOL_cset = 99, /* cset */
- YYSYMBOL_ctype = 100, /* ctype */
- YYSYMBOL_enum_type = 101, /* enum_type */
- YYSYMBOL_102_12 = 102, /* $@12 */
- YYSYMBOL_enum_list = 103, /* enum_list */
- YYSYMBOL_enum_def = 104, /* enum_def */
- YYSYMBOL_105_13 = 105, /* $@13 */
- YYSYMBOL_enum_symbol = 106, /* enum_symbol */
- YYSYMBOL_enum_val = 107 /* enum_val */
+ YYSYMBOL_H5T_IEEE_F16BE_TOKEN = 30, /* H5T_IEEE_F16BE_TOKEN */
+ YYSYMBOL_H5T_IEEE_F16LE_TOKEN = 31, /* H5T_IEEE_F16LE_TOKEN */
+ YYSYMBOL_H5T_IEEE_F32BE_TOKEN = 32, /* H5T_IEEE_F32BE_TOKEN */
+ YYSYMBOL_H5T_IEEE_F32LE_TOKEN = 33, /* H5T_IEEE_F32LE_TOKEN */
+ YYSYMBOL_H5T_IEEE_F64BE_TOKEN = 34, /* H5T_IEEE_F64BE_TOKEN */
+ YYSYMBOL_H5T_IEEE_F64LE_TOKEN = 35, /* H5T_IEEE_F64LE_TOKEN */
+ YYSYMBOL_H5T_NATIVE_FLOAT16_TOKEN = 36, /* H5T_NATIVE_FLOAT16_TOKEN */
+ YYSYMBOL_H5T_NATIVE_FLOAT_TOKEN = 37, /* H5T_NATIVE_FLOAT_TOKEN */
+ YYSYMBOL_H5T_NATIVE_DOUBLE_TOKEN = 38, /* H5T_NATIVE_DOUBLE_TOKEN */
+ YYSYMBOL_H5T_NATIVE_LDOUBLE_TOKEN = 39, /* H5T_NATIVE_LDOUBLE_TOKEN */
+ YYSYMBOL_H5T_STRING_TOKEN = 40, /* H5T_STRING_TOKEN */
+ YYSYMBOL_STRSIZE_TOKEN = 41, /* STRSIZE_TOKEN */
+ YYSYMBOL_STRPAD_TOKEN = 42, /* STRPAD_TOKEN */
+ YYSYMBOL_CSET_TOKEN = 43, /* CSET_TOKEN */
+ YYSYMBOL_CTYPE_TOKEN = 44, /* CTYPE_TOKEN */
+ YYSYMBOL_H5T_VARIABLE_TOKEN = 45, /* H5T_VARIABLE_TOKEN */
+ YYSYMBOL_H5T_STR_NULLTERM_TOKEN = 46, /* H5T_STR_NULLTERM_TOKEN */
+ YYSYMBOL_H5T_STR_NULLPAD_TOKEN = 47, /* H5T_STR_NULLPAD_TOKEN */
+ YYSYMBOL_H5T_STR_SPACEPAD_TOKEN = 48, /* H5T_STR_SPACEPAD_TOKEN */
+ YYSYMBOL_H5T_CSET_ASCII_TOKEN = 49, /* H5T_CSET_ASCII_TOKEN */
+ YYSYMBOL_H5T_CSET_UTF8_TOKEN = 50, /* H5T_CSET_UTF8_TOKEN */
+ YYSYMBOL_H5T_C_S1_TOKEN = 51, /* H5T_C_S1_TOKEN */
+ YYSYMBOL_H5T_FORTRAN_S1_TOKEN = 52, /* H5T_FORTRAN_S1_TOKEN */
+ YYSYMBOL_H5T_OPAQUE_TOKEN = 53, /* H5T_OPAQUE_TOKEN */
+ YYSYMBOL_OPQ_SIZE_TOKEN = 54, /* OPQ_SIZE_TOKEN */
+ YYSYMBOL_OPQ_TAG_TOKEN = 55, /* OPQ_TAG_TOKEN */
+ YYSYMBOL_H5T_COMPOUND_TOKEN = 56, /* H5T_COMPOUND_TOKEN */
+ YYSYMBOL_H5T_ENUM_TOKEN = 57, /* H5T_ENUM_TOKEN */
+ YYSYMBOL_H5T_ARRAY_TOKEN = 58, /* H5T_ARRAY_TOKEN */
+ YYSYMBOL_H5T_VLEN_TOKEN = 59, /* H5T_VLEN_TOKEN */
+ YYSYMBOL_STRING = 60, /* STRING */
+ YYSYMBOL_NUMBER = 61, /* NUMBER */
+ YYSYMBOL_62_ = 62, /* '{' */
+ YYSYMBOL_63_ = 63, /* '}' */
+ YYSYMBOL_64_ = 64, /* '[' */
+ YYSYMBOL_65_ = 65, /* ']' */
+ YYSYMBOL_66_ = 66, /* ':' */
+ YYSYMBOL_67_ = 67, /* ';' */
+ YYSYMBOL_YYACCEPT = 68, /* $accept */
+ YYSYMBOL_start = 69, /* start */
+ YYSYMBOL_ddl_type = 70, /* ddl_type */
+ YYSYMBOL_atomic_type = 71, /* atomic_type */
+ YYSYMBOL_integer_type = 72, /* integer_type */
+ YYSYMBOL_fp_type = 73, /* fp_type */
+ YYSYMBOL_compound_type = 74, /* compound_type */
+ YYSYMBOL_75_1 = 75, /* $@1 */
+ YYSYMBOL_memb_list = 76, /* memb_list */
+ YYSYMBOL_memb_def = 77, /* memb_def */
+ YYSYMBOL_78_2 = 78, /* $@2 */
+ YYSYMBOL_field_name = 79, /* field_name */
+ YYSYMBOL_field_offset = 80, /* field_offset */
+ YYSYMBOL_offset = 81, /* offset */
+ YYSYMBOL_array_type = 82, /* array_type */
+ YYSYMBOL_83_3 = 83, /* $@3 */
+ YYSYMBOL_dim_list = 84, /* dim_list */
+ YYSYMBOL_dim = 85, /* dim */
+ YYSYMBOL_86_4 = 86, /* $@4 */
+ YYSYMBOL_87_5 = 87, /* $@5 */
+ YYSYMBOL_dimsize = 88, /* dimsize */
+ YYSYMBOL_vlen_type = 89, /* vlen_type */
+ YYSYMBOL_opaque_type = 90, /* opaque_type */
+ YYSYMBOL_91_6 = 91, /* @6 */
+ YYSYMBOL_92_7 = 92, /* $@7 */
+ YYSYMBOL_opaque_size = 93, /* opaque_size */
+ YYSYMBOL_opaque_tag = 94, /* opaque_tag */
+ YYSYMBOL_string_type = 95, /* string_type */
+ YYSYMBOL_96_8 = 96, /* $@8 */
+ YYSYMBOL_97_9 = 97, /* $@9 */
+ YYSYMBOL_98_10 = 98, /* $@10 */
+ YYSYMBOL_99_11 = 99, /* @11 */
+ YYSYMBOL_strsize = 100, /* strsize */
+ YYSYMBOL_strpad = 101, /* strpad */
+ YYSYMBOL_cset = 102, /* cset */
+ YYSYMBOL_ctype = 103, /* ctype */
+ YYSYMBOL_enum_type = 104, /* enum_type */
+ YYSYMBOL_105_12 = 105, /* $@12 */
+ YYSYMBOL_enum_list = 106, /* enum_list */
+ YYSYMBOL_enum_def = 107, /* enum_def */
+ YYSYMBOL_108_13 = 108, /* $@13 */
+ YYSYMBOL_enum_symbol = 109, /* enum_symbol */
+ YYSYMBOL_enum_val = 110 /* enum_val */
};
typedef enum yysymbol_kind_t yysymbol_kind_t;
@@ -616,21 +619,21 @@ union yyalloc
#endif /* !YYCOPY_NEEDED */
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 58
+#define YYFINAL 61
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 197
+#define YYLAST 206
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 65
+#define YYNTOKENS 68
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 43
/* YYNRULES -- Number of rules. */
-#define YYNRULES 92
+#define YYNRULES 95
/* YYNSTATES -- Number of states. */
-#define YYNSTATES 134
+#define YYNSTATES 137
/* YYMAXUTOK -- Last valid token kind. */
-#define YYMAXUTOK 313
+#define YYMAXUTOK 316
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
@@ -649,14 +652,14 @@ static const yytype_int8 yytranslate[] =
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 63, 64,
+ 2, 2, 2, 2, 2, 2, 2, 2, 66, 67,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 61, 2, 62, 2, 2, 2, 2, 2, 2,
+ 2, 64, 2, 65, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 59, 2, 60, 2, 2, 2, 2,
+ 2, 2, 2, 62, 2, 63, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -675,23 +678,23 @@ static const yytype_int8 yytranslate[] =
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
- 55, 56, 57, 58
+ 55, 56, 57, 58, 59, 60, 61
};
#if YYDEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_int16 yyrline[] =
{
- 0, 101, 101, 102, 104, 105, 106, 107, 109, 110,
- 111, 112, 113, 116, 117, 118, 119, 120, 121, 122,
- 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
- 133, 134, 135, 136, 137, 138, 139, 140, 141, 142,
- 145, 146, 147, 148, 149, 150, 151, 155, 154, 163,
- 164, 166, 166, 203, 211, 212, 215, 217, 217, 226,
- 227, 229, 230, 229, 237, 240, 247, 252, 244, 259,
- 261, 266, 273, 282, 289, 263, 313, 314, 316, 317,
- 318, 320, 321, 323, 324, 328, 327, 332, 333, 335,
- 335, 385, 387
+ 0, 102, 102, 103, 105, 106, 107, 108, 110, 111,
+ 112, 113, 114, 117, 118, 119, 120, 121, 122, 123,
+ 124, 125, 126, 127, 128, 129, 130, 131, 132, 133,
+ 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
+ 146, 147, 148, 149, 150, 151, 152, 153, 154, 155,
+ 159, 158, 167, 168, 170, 170, 207, 215, 216, 219,
+ 221, 221, 230, 231, 233, 234, 233, 241, 244, 251,
+ 256, 248, 263, 265, 270, 277, 286, 293, 267, 317,
+ 318, 320, 321, 322, 324, 325, 327, 328, 332, 331,
+ 336, 337, 339, 339, 389, 391
};
#endif
@@ -718,24 +721,26 @@ static const char *const yytname[] =
"H5T_NATIVE_USHORT_TOKEN", "H5T_NATIVE_INT_TOKEN",
"H5T_NATIVE_UINT_TOKEN", "H5T_NATIVE_LONG_TOKEN",
"H5T_NATIVE_ULONG_TOKEN", "H5T_NATIVE_LLONG_TOKEN",
- "H5T_NATIVE_ULLONG_TOKEN", "H5T_IEEE_F32BE_TOKEN",
- "H5T_IEEE_F32LE_TOKEN", "H5T_IEEE_F64BE_TOKEN", "H5T_IEEE_F64LE_TOKEN",
- "H5T_NATIVE_FLOAT_TOKEN", "H5T_NATIVE_DOUBLE_TOKEN",
- "H5T_NATIVE_LDOUBLE_TOKEN", "H5T_STRING_TOKEN", "STRSIZE_TOKEN",
- "STRPAD_TOKEN", "CSET_TOKEN", "CTYPE_TOKEN", "H5T_VARIABLE_TOKEN",
- "H5T_STR_NULLTERM_TOKEN", "H5T_STR_NULLPAD_TOKEN",
- "H5T_STR_SPACEPAD_TOKEN", "H5T_CSET_ASCII_TOKEN", "H5T_CSET_UTF8_TOKEN",
- "H5T_C_S1_TOKEN", "H5T_FORTRAN_S1_TOKEN", "H5T_OPAQUE_TOKEN",
- "OPQ_SIZE_TOKEN", "OPQ_TAG_TOKEN", "H5T_COMPOUND_TOKEN",
- "H5T_ENUM_TOKEN", "H5T_ARRAY_TOKEN", "H5T_VLEN_TOKEN", "STRING",
- "NUMBER", "'{'", "'}'", "'['", "']'", "':'", "';'", "$accept", "start",
- "ddl_type", "atomic_type", "integer_type", "fp_type", "compound_type",
- "$@1", "memb_list", "memb_def", "$@2", "field_name", "field_offset",
- "offset", "array_type", "$@3", "dim_list", "dim", "$@4", "$@5",
- "dimsize", "vlen_type", "opaque_type", "@6", "$@7", "opaque_size",
- "opaque_tag", "string_type", "$@8", "$@9", "$@10", "@11", "strsize",
- "strpad", "cset", "ctype", "enum_type", "$@12", "enum_list", "enum_def",
- "$@13", "enum_symbol", "enum_val", YY_NULLPTR
+ "H5T_NATIVE_ULLONG_TOKEN", "H5T_IEEE_F16BE_TOKEN",
+ "H5T_IEEE_F16LE_TOKEN", "H5T_IEEE_F32BE_TOKEN", "H5T_IEEE_F32LE_TOKEN",
+ "H5T_IEEE_F64BE_TOKEN", "H5T_IEEE_F64LE_TOKEN",
+ "H5T_NATIVE_FLOAT16_TOKEN", "H5T_NATIVE_FLOAT_TOKEN",
+ "H5T_NATIVE_DOUBLE_TOKEN", "H5T_NATIVE_LDOUBLE_TOKEN",
+ "H5T_STRING_TOKEN", "STRSIZE_TOKEN", "STRPAD_TOKEN", "CSET_TOKEN",
+ "CTYPE_TOKEN", "H5T_VARIABLE_TOKEN", "H5T_STR_NULLTERM_TOKEN",
+ "H5T_STR_NULLPAD_TOKEN", "H5T_STR_SPACEPAD_TOKEN",
+ "H5T_CSET_ASCII_TOKEN", "H5T_CSET_UTF8_TOKEN", "H5T_C_S1_TOKEN",
+ "H5T_FORTRAN_S1_TOKEN", "H5T_OPAQUE_TOKEN", "OPQ_SIZE_TOKEN",
+ "OPQ_TAG_TOKEN", "H5T_COMPOUND_TOKEN", "H5T_ENUM_TOKEN",
+ "H5T_ARRAY_TOKEN", "H5T_VLEN_TOKEN", "STRING", "NUMBER", "'{'", "'}'",
+ "'['", "']'", "':'", "';'", "$accept", "start", "ddl_type",
+ "atomic_type", "integer_type", "fp_type", "compound_type", "$@1",
+ "memb_list", "memb_def", "$@2", "field_name", "field_offset", "offset",
+ "array_type", "$@3", "dim_list", "dim", "$@4", "$@5", "dimsize",
+ "vlen_type", "opaque_type", "@6", "$@7", "opaque_size", "opaque_tag",
+ "string_type", "$@8", "$@9", "$@10", "@11", "strsize", "strpad", "cset",
+ "ctype", "enum_type", "$@12", "enum_list", "enum_def", "$@13",
+ "enum_symbol", "enum_val", YY_NULLPTR
};
static const char *
@@ -759,20 +764,20 @@ yysymbol_name (yysymbol_kind_t yysymbol)
STATE-NUM. */
static const yytype_int16 yypact[] =
{
- 114, -25, -25, -25, -25, -25, -25, -25, -25, -25,
+ 120, -25, -25, -25, -25, -25, -25, -25, -25, -25,
-25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
-25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
- -25, -25, -25, -25, -25, -24, -22, -25, -13, -25,
- -11, 49, -25, -25, -25, -25, -25, -25, -25, -25,
- -25, -25, 18, 45, 38, 168, 39, 114, -25, -4,
- 41, -25, 36, -25, 42, -25, -25, 37, -25, 40,
- 56, -25, -3, -25, -25, -25, -25, -25, -25, -25,
- -25, 43, -25, 66, 55, 51, -21, 57, -25, 0,
- 95, -25, 50, -25, -25, -25, -25, -25, -25, -25,
- -25, -25, 89, -25, 90, 97, 92, 99, 52, -25,
- -25, -25, -25, -25, -25, 94, -25, 119, 100, -25,
- -6, -25, -25, -25, 98, -25, 120, 46, -25, -25,
- 101, -25, 103, -25
+ -25, -25, -25, -25, -25, -25, -25, -25, -24, -22,
+ -25, -13, -25, -11, 52, -25, -25, -25, -25, -25,
+ -25, -25, -25, -25, -25, 18, 48, 41, 177, 42,
+ 120, -25, -4, 44, -25, 39, -25, 45, -25, -25,
+ 40, -25, 43, 59, -25, -3, -25, -25, -25, -25,
+ -25, -25, -25, -25, 46, -25, 69, 58, 54, -21,
+ 60, -25, 0, 101, -25, 53, -25, -25, -25, -25,
+ -25, -25, -25, -25, -25, 95, -25, 96, 103, 98,
+ 105, 55, -25, -25, -25, -25, -25, -25, 100, -25,
+ 125, 106, -25, -6, -25, -25, -25, 104, -25, 126,
+ 49, -25, -25, 107, -25, 109, -25
};
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
@@ -783,23 +788,23 @@ static const yytype_int8 yydefact[] =
2, 13, 14, 15, 16, 17, 18, 19, 20, 21,
22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
- 42, 43, 44, 45, 46, 0, 0, 47, 0, 57,
- 0, 0, 3, 4, 8, 9, 5, 6, 7, 12,
- 10, 11, 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 49, 0, 59, 0, 76, 77, 0, 69, 0,
- 0, 85, 0, 65, 71, 66, 48, 51, 50, 87,
- 61, 0, 60, 0, 0, 0, 0, 0, 58, 0,
- 0, 53, 54, 91, 86, 88, 89, 64, 62, 78,
- 79, 80, 0, 70, 0, 0, 0, 0, 0, 72,
- 67, 56, 55, 52, 92, 0, 63, 0, 0, 90,
- 0, 68, 81, 82, 0, 73, 0, 0, 83, 84,
- 0, 74, 0, 75
+ 42, 43, 44, 45, 46, 47, 48, 49, 0, 0,
+ 50, 0, 60, 0, 0, 3, 4, 8, 9, 5,
+ 6, 7, 12, 10, 11, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 52, 0, 62, 0, 79, 80,
+ 0, 72, 0, 0, 88, 0, 68, 74, 69, 51,
+ 54, 53, 90, 64, 0, 63, 0, 0, 0, 0,
+ 0, 61, 0, 0, 56, 57, 94, 89, 91, 92,
+ 67, 65, 81, 82, 83, 0, 73, 0, 0, 0,
+ 0, 0, 75, 70, 59, 58, 55, 95, 0, 66,
+ 0, 0, 93, 0, 71, 84, 85, 0, 76, 0,
+ 0, 86, 87, 0, 77, 0, 78
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -25, -25, -15, -25, 111, -25, -25, -25, -25, -25,
+ -25, -25, -15, -25, 117, -25, -25, -25, -25, -25,
-25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
-25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
-25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
@@ -809,11 +814,11 @@ static const yytype_int8 yypgoto[] =
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_uint8 yydefgoto[] =
{
- 0, 41, 42, 43, 44, 45, 46, 54, 70, 78,
- 85, 92, 106, 112, 47, 56, 72, 82, 87, 108,
- 98, 48, 49, 84, 118, 69, 104, 50, 83, 117,
- 126, 132, 67, 102, 124, 130, 51, 79, 86, 95,
- 107, 96, 115
+ 0, 44, 45, 46, 47, 48, 49, 57, 73, 81,
+ 88, 95, 109, 115, 50, 59, 75, 85, 90, 111,
+ 101, 51, 52, 87, 121, 72, 107, 53, 86, 120,
+ 129, 135, 70, 105, 127, 133, 54, 82, 89, 98,
+ 110, 99, 118
};
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
@@ -824,23 +829,24 @@ static const yytype_uint8 yytable[] =
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 31, 32, 33, 34, 35, 52, 93, 53, 65, 94,
- 122, 123, 64, 99, 100, 101, 55, 36, 57, 58,
- 37, 38, 39, 40, 66, 77, 59, 81, 80, 1,
- 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
- 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
- 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 128, 129, 60, 61, 63, 68,
- 71, 74, 73, 88, 75, 89, 36, 90, 91, 37,
- 38, 39, 40, 105, 116, 97, 76, 1, 2, 3,
- 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
- 34, 35, 103, 109, 110, 111, 113, 114, 119, 120,
- 121, 127, 125, 133, 36, 131, 62, 37, 38, 39,
- 40, 1, 2, 3, 4, 5, 6, 7, 8, 9,
- 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
- 20, 21, 22, 23, 24, 25, 26, 27
+ 31, 32, 33, 34, 35, 36, 37, 38, 55, 96,
+ 56, 68, 97, 125, 126, 67, 102, 103, 104, 58,
+ 39, 60, 61, 40, 41, 42, 43, 69, 80, 62,
+ 84, 83, 1, 2, 3, 4, 5, 6, 7, 8,
+ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 131, 132, 63, 64, 66, 71, 74, 77, 76, 91,
+ 78, 92, 39, 93, 94, 40, 41, 42, 43, 108,
+ 119, 100, 79, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
+ 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
+ 38, 106, 112, 113, 114, 116, 117, 122, 123, 124,
+ 130, 128, 136, 39, 134, 65, 40, 41, 42, 43,
+ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
+ 21, 22, 23, 24, 25, 26, 27
};
static const yytype_int8 yycheck[] =
@@ -848,23 +854,24 @@ static const yytype_int8 yycheck[] =
3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
- 33, 34, 35, 36, 37, 59, 57, 59, 42, 60,
- 46, 47, 57, 43, 44, 45, 59, 50, 59, 0,
- 53, 54, 55, 56, 58, 70, 38, 72, 61, 3,
- 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
- 34, 35, 36, 37, 48, 49, 51, 59, 59, 58,
- 64, 64, 60, 60, 64, 39, 50, 52, 57, 53,
- 54, 55, 56, 63, 62, 58, 60, 3, 4, 5,
- 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
- 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
- 36, 37, 57, 64, 64, 58, 64, 58, 64, 40,
- 60, 41, 64, 60, 50, 64, 55, 53, 54, 55,
- 56, 3, 4, 5, 6, 7, 8, 9, 10, 11,
- 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
- 22, 23, 24, 25, 26, 27, 28, 29
+ 33, 34, 35, 36, 37, 38, 39, 40, 62, 60,
+ 62, 45, 63, 49, 50, 60, 46, 47, 48, 62,
+ 53, 62, 0, 56, 57, 58, 59, 61, 73, 41,
+ 75, 64, 3, 4, 5, 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
+ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
+ 51, 52, 54, 62, 62, 61, 67, 67, 63, 63,
+ 67, 42, 53, 55, 60, 56, 57, 58, 59, 66,
+ 65, 61, 63, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 60, 67, 67, 61, 67, 61, 67, 43, 63,
+ 44, 67, 63, 53, 67, 58, 56, 57, 58, 59,
+ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
+ 23, 24, 25, 26, 27, 28, 29
};
/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
@@ -874,32 +881,32 @@ static const yytype_int8 yystos[] =
0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 50, 53, 54, 55,
- 56, 66, 67, 68, 69, 70, 71, 79, 86, 87,
- 92, 101, 59, 59, 72, 59, 80, 59, 0, 38,
- 51, 59, 69, 59, 67, 42, 58, 97, 58, 90,
- 73, 64, 81, 60, 64, 64, 60, 67, 74, 102,
- 61, 67, 82, 93, 88, 75, 103, 83, 60, 39,
- 52, 57, 76, 57, 60, 104, 106, 58, 85, 43,
- 44, 45, 98, 57, 91, 63, 77, 105, 84, 64,
- 64, 58, 78, 64, 58, 107, 62, 94, 89, 64,
- 40, 60, 46, 47, 99, 64, 95, 41, 48, 49,
- 100, 64, 96, 60
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 53,
+ 56, 57, 58, 59, 69, 70, 71, 72, 73, 74,
+ 82, 89, 90, 95, 104, 62, 62, 75, 62, 83,
+ 62, 0, 41, 54, 62, 72, 62, 70, 45, 61,
+ 100, 61, 93, 76, 67, 84, 63, 67, 67, 63,
+ 70, 77, 105, 64, 70, 85, 96, 91, 78, 106,
+ 86, 63, 42, 55, 60, 79, 60, 63, 107, 109,
+ 61, 88, 46, 47, 48, 101, 60, 94, 66, 80,
+ 108, 87, 67, 67, 61, 81, 67, 61, 110, 65,
+ 97, 92, 67, 43, 63, 49, 50, 102, 67, 98,
+ 44, 51, 52, 103, 67, 99, 63
};
/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
static const yytype_int8 yyr1[] =
{
- 0, 65, 66, 66, 67, 67, 67, 67, 68, 68,
- 68, 68, 68, 69, 69, 69, 69, 69, 69, 69,
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
- 70, 70, 70, 70, 70, 70, 70, 72, 71, 73,
- 73, 75, 74, 76, 77, 77, 78, 80, 79, 81,
- 81, 83, 84, 82, 85, 86, 88, 89, 87, 90,
- 91, 93, 94, 95, 96, 92, 97, 97, 98, 98,
- 98, 99, 99, 100, 100, 102, 101, 103, 103, 105,
- 104, 106, 107
+ 0, 68, 69, 69, 70, 70, 70, 70, 71, 71,
+ 71, 71, 71, 72, 72, 72, 72, 72, 72, 72,
+ 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
+ 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
+ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
+ 75, 74, 76, 76, 78, 77, 79, 80, 80, 81,
+ 83, 82, 84, 84, 86, 87, 85, 88, 89, 91,
+ 92, 90, 93, 94, 96, 97, 98, 99, 95, 100,
+ 100, 101, 101, 101, 102, 102, 103, 103, 105, 104,
+ 106, 106, 108, 107, 109, 110
};
/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
@@ -909,12 +916,12 @@ static const yytype_int8 yyr2[] =
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 0, 5, 0,
- 2, 0, 5, 1, 0, 2, 1, 0, 6, 0,
- 2, 0, 0, 5, 1, 4, 0, 0, 11, 1,
- 1, 0, 0, 0, 0, 19, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 0, 7, 0, 2, 0,
- 4, 1, 1
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 5, 0, 2, 0, 5, 1, 0, 2, 1,
+ 0, 6, 0, 2, 0, 0, 5, 1, 4, 0,
+ 0, 11, 1, 1, 0, 0, 0, 0, 19, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 0, 7,
+ 0, 2, 0, 4, 1, 1
};
@@ -1378,245 +1385,263 @@ yyreduce:
switch (yyn)
{
case 2: /* start: %empty */
-#line 101 "hl/src//H5LTparse.y"
+#line 102 "hl/src//H5LTparse.y"
{ memset(arr_stack, 0, STACK_SIZE*sizeof(struct arr_info)); /*initialize here?*/ }
-#line 1353 "hl/src//H5LTparse.c"
+#line 1360 "hl/src//H5LTparse.c"
break;
case 3: /* start: ddl_type */
-#line 102 "hl/src//H5LTparse.y"
+#line 103 "hl/src//H5LTparse.y"
{ return (yyval.hid);}
-#line 1359 "hl/src//H5LTparse.c"
+#line 1366 "hl/src//H5LTparse.c"
break;
case 13: /* integer_type: H5T_STD_I8BE_TOKEN */
-#line 116 "hl/src//H5LTparse.y"
+#line 117 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_I8BE); }
-#line 1365 "hl/src//H5LTparse.c"
+#line 1372 "hl/src//H5LTparse.c"
break;
case 14: /* integer_type: H5T_STD_I8LE_TOKEN */
-#line 117 "hl/src//H5LTparse.y"
+#line 118 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_I8LE); }
-#line 1371 "hl/src//H5LTparse.c"
+#line 1378 "hl/src//H5LTparse.c"
break;
case 15: /* integer_type: H5T_STD_I16BE_TOKEN */
-#line 118 "hl/src//H5LTparse.y"
+#line 119 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_I16BE); }
-#line 1377 "hl/src//H5LTparse.c"
+#line 1384 "hl/src//H5LTparse.c"
break;
case 16: /* integer_type: H5T_STD_I16LE_TOKEN */
-#line 119 "hl/src//H5LTparse.y"
+#line 120 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_I16LE); }
-#line 1383 "hl/src//H5LTparse.c"
+#line 1390 "hl/src//H5LTparse.c"
break;
case 17: /* integer_type: H5T_STD_I32BE_TOKEN */
-#line 120 "hl/src//H5LTparse.y"
+#line 121 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_I32BE); }
-#line 1389 "hl/src//H5LTparse.c"
+#line 1396 "hl/src//H5LTparse.c"
break;
case 18: /* integer_type: H5T_STD_I32LE_TOKEN */
-#line 121 "hl/src//H5LTparse.y"
+#line 122 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_I32LE); }
-#line 1395 "hl/src//H5LTparse.c"
+#line 1402 "hl/src//H5LTparse.c"
break;
case 19: /* integer_type: H5T_STD_I64BE_TOKEN */
-#line 122 "hl/src//H5LTparse.y"
+#line 123 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_I64BE); }
-#line 1401 "hl/src//H5LTparse.c"
+#line 1408 "hl/src//H5LTparse.c"
break;
case 20: /* integer_type: H5T_STD_I64LE_TOKEN */
-#line 123 "hl/src//H5LTparse.y"
+#line 124 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_I64LE); }
-#line 1407 "hl/src//H5LTparse.c"
+#line 1414 "hl/src//H5LTparse.c"
break;
case 21: /* integer_type: H5T_STD_U8BE_TOKEN */
-#line 124 "hl/src//H5LTparse.y"
+#line 125 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_U8BE); }
-#line 1413 "hl/src//H5LTparse.c"
+#line 1420 "hl/src//H5LTparse.c"
break;
case 22: /* integer_type: H5T_STD_U8LE_TOKEN */
-#line 125 "hl/src//H5LTparse.y"
+#line 126 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_U8LE); }
-#line 1419 "hl/src//H5LTparse.c"
+#line 1426 "hl/src//H5LTparse.c"
break;
case 23: /* integer_type: H5T_STD_U16BE_TOKEN */
-#line 126 "hl/src//H5LTparse.y"
+#line 127 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_U16BE); }
-#line 1425 "hl/src//H5LTparse.c"
+#line 1432 "hl/src//H5LTparse.c"
break;
case 24: /* integer_type: H5T_STD_U16LE_TOKEN */
-#line 127 "hl/src//H5LTparse.y"
+#line 128 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_U16LE); }
-#line 1431 "hl/src//H5LTparse.c"
+#line 1438 "hl/src//H5LTparse.c"
break;
case 25: /* integer_type: H5T_STD_U32BE_TOKEN */
-#line 128 "hl/src//H5LTparse.y"
+#line 129 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_U32BE); }
-#line 1437 "hl/src//H5LTparse.c"
+#line 1444 "hl/src//H5LTparse.c"
break;
case 26: /* integer_type: H5T_STD_U32LE_TOKEN */
-#line 129 "hl/src//H5LTparse.y"
+#line 130 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_U32LE); }
-#line 1443 "hl/src//H5LTparse.c"
+#line 1450 "hl/src//H5LTparse.c"
break;
case 27: /* integer_type: H5T_STD_U64BE_TOKEN */
-#line 130 "hl/src//H5LTparse.y"
+#line 131 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_U64BE); }
-#line 1449 "hl/src//H5LTparse.c"
+#line 1456 "hl/src//H5LTparse.c"
break;
case 28: /* integer_type: H5T_STD_U64LE_TOKEN */
-#line 131 "hl/src//H5LTparse.y"
+#line 132 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_U64LE); }
-#line 1455 "hl/src//H5LTparse.c"
+#line 1462 "hl/src//H5LTparse.c"
break;
case 29: /* integer_type: H5T_NATIVE_CHAR_TOKEN */
-#line 132 "hl/src//H5LTparse.y"
+#line 133 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_CHAR); }
-#line 1461 "hl/src//H5LTparse.c"
+#line 1468 "hl/src//H5LTparse.c"
break;
case 30: /* integer_type: H5T_NATIVE_SCHAR_TOKEN */
-#line 133 "hl/src//H5LTparse.y"
+#line 134 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_SCHAR); }
-#line 1467 "hl/src//H5LTparse.c"
+#line 1474 "hl/src//H5LTparse.c"
break;
case 31: /* integer_type: H5T_NATIVE_UCHAR_TOKEN */
-#line 134 "hl/src//H5LTparse.y"
+#line 135 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_UCHAR); }
-#line 1473 "hl/src//H5LTparse.c"
+#line 1480 "hl/src//H5LTparse.c"
break;
case 32: /* integer_type: H5T_NATIVE_SHORT_TOKEN */
-#line 135 "hl/src//H5LTparse.y"
+#line 136 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_SHORT); }
-#line 1479 "hl/src//H5LTparse.c"
+#line 1486 "hl/src//H5LTparse.c"
break;
case 33: /* integer_type: H5T_NATIVE_USHORT_TOKEN */
-#line 136 "hl/src//H5LTparse.y"
+#line 137 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_USHORT); }
-#line 1485 "hl/src//H5LTparse.c"
+#line 1492 "hl/src//H5LTparse.c"
break;
case 34: /* integer_type: H5T_NATIVE_INT_TOKEN */
-#line 137 "hl/src//H5LTparse.y"
+#line 138 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_INT); }
-#line 1491 "hl/src//H5LTparse.c"
+#line 1498 "hl/src//H5LTparse.c"
break;
case 35: /* integer_type: H5T_NATIVE_UINT_TOKEN */
-#line 138 "hl/src//H5LTparse.y"
+#line 139 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_UINT); }
-#line 1497 "hl/src//H5LTparse.c"
+#line 1504 "hl/src//H5LTparse.c"
break;
case 36: /* integer_type: H5T_NATIVE_LONG_TOKEN */
-#line 139 "hl/src//H5LTparse.y"
+#line 140 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_LONG); }
-#line 1503 "hl/src//H5LTparse.c"
+#line 1510 "hl/src//H5LTparse.c"
break;
case 37: /* integer_type: H5T_NATIVE_ULONG_TOKEN */
-#line 140 "hl/src//H5LTparse.y"
+#line 141 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_ULONG); }
-#line 1509 "hl/src//H5LTparse.c"
+#line 1516 "hl/src//H5LTparse.c"
break;
case 38: /* integer_type: H5T_NATIVE_LLONG_TOKEN */
-#line 141 "hl/src//H5LTparse.y"
+#line 142 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_LLONG); }
-#line 1515 "hl/src//H5LTparse.c"
+#line 1522 "hl/src//H5LTparse.c"
break;
case 39: /* integer_type: H5T_NATIVE_ULLONG_TOKEN */
-#line 142 "hl/src//H5LTparse.y"
+#line 143 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_ULLONG); }
-#line 1521 "hl/src//H5LTparse.c"
+#line 1528 "hl/src//H5LTparse.c"
+ break;
+
+ case 40: /* fp_type: H5T_IEEE_F16BE_TOKEN */
+#line 146 "hl/src//H5LTparse.y"
+ { (yyval.hid) = H5Tcopy(H5T_IEEE_F16BE); }
+#line 1534 "hl/src//H5LTparse.c"
+ break;
+
+ case 41: /* fp_type: H5T_IEEE_F16LE_TOKEN */
+#line 147 "hl/src//H5LTparse.y"
+ { (yyval.hid) = H5Tcopy(H5T_IEEE_F16LE); }
+#line 1540 "hl/src//H5LTparse.c"
break;
- case 40: /* fp_type: H5T_IEEE_F32BE_TOKEN */
-#line 145 "hl/src//H5LTparse.y"
+ case 42: /* fp_type: H5T_IEEE_F32BE_TOKEN */
+#line 148 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_IEEE_F32BE); }
-#line 1527 "hl/src//H5LTparse.c"
+#line 1546 "hl/src//H5LTparse.c"
break;
- case 41: /* fp_type: H5T_IEEE_F32LE_TOKEN */
-#line 146 "hl/src//H5LTparse.y"
+ case 43: /* fp_type: H5T_IEEE_F32LE_TOKEN */
+#line 149 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_IEEE_F32LE); }
-#line 1533 "hl/src//H5LTparse.c"
+#line 1552 "hl/src//H5LTparse.c"
break;
- case 42: /* fp_type: H5T_IEEE_F64BE_TOKEN */
-#line 147 "hl/src//H5LTparse.y"
+ case 44: /* fp_type: H5T_IEEE_F64BE_TOKEN */
+#line 150 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_IEEE_F64BE); }
-#line 1539 "hl/src//H5LTparse.c"
+#line 1558 "hl/src//H5LTparse.c"
break;
- case 43: /* fp_type: H5T_IEEE_F64LE_TOKEN */
-#line 148 "hl/src//H5LTparse.y"
+ case 45: /* fp_type: H5T_IEEE_F64LE_TOKEN */
+#line 151 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_IEEE_F64LE); }
-#line 1545 "hl/src//H5LTparse.c"
+#line 1564 "hl/src//H5LTparse.c"
break;
- case 44: /* fp_type: H5T_NATIVE_FLOAT_TOKEN */
-#line 149 "hl/src//H5LTparse.y"
+ case 46: /* fp_type: H5T_NATIVE_FLOAT16_TOKEN */
+#line 152 "hl/src//H5LTparse.y"
+ { (yyval.hid) = H5Tcopy(H5T_NATIVE_FLOAT16); }
+#line 1570 "hl/src//H5LTparse.c"
+ break;
+
+ case 47: /* fp_type: H5T_NATIVE_FLOAT_TOKEN */
+#line 153 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_FLOAT); }
-#line 1551 "hl/src//H5LTparse.c"
+#line 1576 "hl/src//H5LTparse.c"
break;
- case 45: /* fp_type: H5T_NATIVE_DOUBLE_TOKEN */
-#line 150 "hl/src//H5LTparse.y"
+ case 48: /* fp_type: H5T_NATIVE_DOUBLE_TOKEN */
+#line 154 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_DOUBLE); }
-#line 1557 "hl/src//H5LTparse.c"
+#line 1582 "hl/src//H5LTparse.c"
break;
- case 46: /* fp_type: H5T_NATIVE_LDOUBLE_TOKEN */
-#line 151 "hl/src//H5LTparse.y"
+ case 49: /* fp_type: H5T_NATIVE_LDOUBLE_TOKEN */
+#line 155 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_LDOUBLE); }
-#line 1563 "hl/src//H5LTparse.c"
+#line 1588 "hl/src//H5LTparse.c"
break;
- case 47: /* $@1: %empty */
-#line 155 "hl/src//H5LTparse.y"
+ case 50: /* $@1: %empty */
+#line 159 "hl/src//H5LTparse.y"
{ csindex++; cmpd_stack[csindex].id = H5Tcreate(H5T_COMPOUND, 1); /*temporarily set size to 1*/ }
-#line 1569 "hl/src//H5LTparse.c"
+#line 1594 "hl/src//H5LTparse.c"
break;
- case 48: /* compound_type: H5T_COMPOUND_TOKEN $@1 '{' memb_list '}' */
-#line 157 "hl/src//H5LTparse.y"
+ case 51: /* compound_type: H5T_COMPOUND_TOKEN $@1 '{' memb_list '}' */
+#line 161 "hl/src//H5LTparse.y"
{ (yyval.hid) = cmpd_stack[csindex].id;
cmpd_stack[csindex].id = 0;
cmpd_stack[csindex].first_memb = 1;
csindex--;
}
-#line 1579 "hl/src//H5LTparse.c"
+#line 1604 "hl/src//H5LTparse.c"
break;
- case 51: /* $@2: %empty */
-#line 166 "hl/src//H5LTparse.y"
+ case 54: /* $@2: %empty */
+#line 170 "hl/src//H5LTparse.y"
{ cmpd_stack[csindex].is_field = 1; /*notify lexer a compound member is parsed*/ }
-#line 1585 "hl/src//H5LTparse.c"
+#line 1610 "hl/src//H5LTparse.c"
break;
- case 52: /* memb_def: ddl_type $@2 field_name field_offset ';' */
-#line 168 "hl/src//H5LTparse.y"
+ case 55: /* memb_def: ddl_type $@2 field_name field_offset ';' */
+#line 172 "hl/src//H5LTparse.y"
{
size_t origin_size, new_size;
hid_t dtype_id = cmpd_stack[csindex].id;
@@ -1651,108 +1676,108 @@ yyreduce:
new_size = H5Tget_size(dtype_id);
}
-#line 1624 "hl/src//H5LTparse.c"
+#line 1649 "hl/src//H5LTparse.c"
break;
- case 53: /* field_name: STRING */
-#line 204 "hl/src//H5LTparse.y"
+ case 56: /* field_name: STRING */
+#line 208 "hl/src//H5LTparse.y"
{
(yyval.sval) = strdup(yylval.sval);
free(yylval.sval);
yylval.sval = NULL;
}
-#line 1634 "hl/src//H5LTparse.c"
+#line 1659 "hl/src//H5LTparse.c"
break;
- case 54: /* field_offset: %empty */
-#line 211 "hl/src//H5LTparse.y"
+ case 57: /* field_offset: %empty */
+#line 215 "hl/src//H5LTparse.y"
{ (yyval.ival) = 0; }
-#line 1640 "hl/src//H5LTparse.c"
+#line 1665 "hl/src//H5LTparse.c"
break;
- case 55: /* field_offset: ':' offset */
-#line 213 "hl/src//H5LTparse.y"
+ case 58: /* field_offset: ':' offset */
+#line 217 "hl/src//H5LTparse.y"
{ (yyval.ival) = yylval.ival; }
-#line 1646 "hl/src//H5LTparse.c"
+#line 1671 "hl/src//H5LTparse.c"
break;
- case 57: /* $@3: %empty */
-#line 217 "hl/src//H5LTparse.y"
+ case 60: /* $@3: %empty */
+#line 221 "hl/src//H5LTparse.y"
{ asindex++; /*pushd onto the stack*/ }
-#line 1652 "hl/src//H5LTparse.c"
+#line 1677 "hl/src//H5LTparse.c"
break;
- case 58: /* array_type: H5T_ARRAY_TOKEN $@3 '{' dim_list ddl_type '}' */
-#line 219 "hl/src//H5LTparse.y"
+ case 61: /* array_type: H5T_ARRAY_TOKEN $@3 '{' dim_list ddl_type '}' */
+#line 223 "hl/src//H5LTparse.y"
{
(yyval.hid) = H5Tarray_create2((yyvsp[-1].hid), arr_stack[asindex].ndims, arr_stack[asindex].dims);
arr_stack[asindex].ndims = 0;
asindex--;
H5Tclose((yyvsp[-1].hid));
}
-#line 1663 "hl/src//H5LTparse.c"
+#line 1688 "hl/src//H5LTparse.c"
break;
- case 61: /* $@4: %empty */
-#line 229 "hl/src//H5LTparse.y"
+ case 64: /* $@4: %empty */
+#line 233 "hl/src//H5LTparse.y"
{ arr_stack[asindex].is_dim = 1; /*notice lexer of dimension size*/ }
-#line 1669 "hl/src//H5LTparse.c"
+#line 1694 "hl/src//H5LTparse.c"
break;
- case 62: /* $@5: %empty */
-#line 230 "hl/src//H5LTparse.y"
+ case 65: /* $@5: %empty */
+#line 234 "hl/src//H5LTparse.y"
{ unsigned ndims = arr_stack[asindex].ndims;
arr_stack[asindex].dims[ndims] = (hsize_t)yylval.ival;
arr_stack[asindex].ndims++;
arr_stack[asindex].is_dim = 0;
}
-#line 1679 "hl/src//H5LTparse.c"
+#line 1704 "hl/src//H5LTparse.c"
break;
- case 65: /* vlen_type: H5T_VLEN_TOKEN '{' ddl_type '}' */
-#line 241 "hl/src//H5LTparse.y"
+ case 68: /* vlen_type: H5T_VLEN_TOKEN '{' ddl_type '}' */
+#line 245 "hl/src//H5LTparse.y"
{ (yyval.hid) = H5Tvlen_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); }
-#line 1685 "hl/src//H5LTparse.c"
+#line 1710 "hl/src//H5LTparse.c"
break;
- case 66: /* @6: %empty */
-#line 247 "hl/src//H5LTparse.y"
+ case 69: /* @6: %empty */
+#line 251 "hl/src//H5LTparse.y"
{
size_t size = (size_t)yylval.ival;
(yyval.hid) = H5Tcreate(H5T_OPAQUE, size);
}
-#line 1694 "hl/src//H5LTparse.c"
+#line 1719 "hl/src//H5LTparse.c"
break;
- case 67: /* $@7: %empty */
-#line 252 "hl/src//H5LTparse.y"
+ case 70: /* $@7: %empty */
+#line 256 "hl/src//H5LTparse.y"
{
H5Tset_tag((yyvsp[-3].hid), yylval.sval);
free(yylval.sval);
yylval.sval = NULL;
}
-#line 1704 "hl/src//H5LTparse.c"
+#line 1729 "hl/src//H5LTparse.c"
break;
- case 68: /* opaque_type: H5T_OPAQUE_TOKEN '{' OPQ_SIZE_TOKEN opaque_size ';' @6 OPQ_TAG_TOKEN opaque_tag ';' $@7 '}' */
-#line 257 "hl/src//H5LTparse.y"
+ case 71: /* opaque_type: H5T_OPAQUE_TOKEN '{' OPQ_SIZE_TOKEN opaque_size ';' @6 OPQ_TAG_TOKEN opaque_tag ';' $@7 '}' */
+#line 261 "hl/src//H5LTparse.y"
{ (yyval.hid) = (yyvsp[-5].hid); }
-#line 1710 "hl/src//H5LTparse.c"
+#line 1735 "hl/src//H5LTparse.c"
break;
- case 71: /* $@8: %empty */
-#line 266 "hl/src//H5LTparse.y"
+ case 74: /* $@8: %empty */
+#line 270 "hl/src//H5LTparse.y"
{
if((yyvsp[-1].ival) == H5T_VARIABLE_TOKEN)
is_variable = 1;
else
str_size = yylval.ival;
}
-#line 1721 "hl/src//H5LTparse.c"
+#line 1746 "hl/src//H5LTparse.c"
break;
- case 72: /* $@9: %empty */
-#line 273 "hl/src//H5LTparse.y"
+ case 75: /* $@9: %empty */
+#line 277 "hl/src//H5LTparse.y"
{
if((yyvsp[-1].ival) == H5T_STR_NULLTERM_TOKEN)
str_pad = H5T_STR_NULLTERM;
@@ -1761,33 +1786,33 @@ yyreduce:
else if((yyvsp[-1].ival) == H5T_STR_SPACEPAD_TOKEN)
str_pad = H5T_STR_SPACEPAD;
}
-#line 1734 "hl/src//H5LTparse.c"
+#line 1759 "hl/src//H5LTparse.c"
break;
- case 73: /* $@10: %empty */
-#line 282 "hl/src//H5LTparse.y"
+ case 76: /* $@10: %empty */
+#line 286 "hl/src//H5LTparse.y"
{
if((yyvsp[-1].ival) == H5T_CSET_ASCII_TOKEN)
str_cset = H5T_CSET_ASCII;
else if((yyvsp[-1].ival) == H5T_CSET_UTF8_TOKEN)
str_cset = H5T_CSET_UTF8;
}
-#line 1745 "hl/src//H5LTparse.c"
+#line 1770 "hl/src//H5LTparse.c"
break;
- case 74: /* @11: %empty */
-#line 289 "hl/src//H5LTparse.y"
+ case 77: /* @11: %empty */
+#line 293 "hl/src//H5LTparse.y"
{
if((yyvsp[-1].hid) == H5T_C_S1_TOKEN)
(yyval.hid) = H5Tcopy(H5T_C_S1);
else if((yyvsp[-1].hid) == H5T_FORTRAN_S1_TOKEN)
(yyval.hid) = H5Tcopy(H5T_FORTRAN_S1);
}
-#line 1756 "hl/src//H5LTparse.c"
+#line 1781 "hl/src//H5LTparse.c"
break;
- case 75: /* string_type: H5T_STRING_TOKEN '{' STRSIZE_TOKEN strsize ';' $@8 STRPAD_TOKEN strpad ';' $@9 CSET_TOKEN cset ';' $@10 CTYPE_TOKEN ctype ';' @11 '}' */
-#line 296 "hl/src//H5LTparse.y"
+ case 78: /* string_type: H5T_STRING_TOKEN '{' STRSIZE_TOKEN strsize ';' $@8 STRPAD_TOKEN strpad ';' $@9 CSET_TOKEN cset ';' $@10 CTYPE_TOKEN ctype ';' @11 '}' */
+#line 300 "hl/src//H5LTparse.y"
{
hid_t str_id = (yyvsp[-1].hid);
@@ -1804,82 +1829,82 @@ yyreduce:
(yyval.hid) = str_id;
}
-#line 1777 "hl/src//H5LTparse.c"
+#line 1802 "hl/src//H5LTparse.c"
break;
- case 76: /* strsize: H5T_VARIABLE_TOKEN */
-#line 313 "hl/src//H5LTparse.y"
+ case 79: /* strsize: H5T_VARIABLE_TOKEN */
+#line 317 "hl/src//H5LTparse.y"
{(yyval.ival) = H5T_VARIABLE_TOKEN;}
-#line 1783 "hl/src//H5LTparse.c"
+#line 1808 "hl/src//H5LTparse.c"
break;
- case 78: /* strpad: H5T_STR_NULLTERM_TOKEN */
-#line 316 "hl/src//H5LTparse.y"
+ case 81: /* strpad: H5T_STR_NULLTERM_TOKEN */
+#line 320 "hl/src//H5LTparse.y"
{(yyval.ival) = H5T_STR_NULLTERM_TOKEN;}
-#line 1789 "hl/src//H5LTparse.c"
+#line 1814 "hl/src//H5LTparse.c"
break;
- case 79: /* strpad: H5T_STR_NULLPAD_TOKEN */
-#line 317 "hl/src//H5LTparse.y"
+ case 82: /* strpad: H5T_STR_NULLPAD_TOKEN */
+#line 321 "hl/src//H5LTparse.y"
{(yyval.ival) = H5T_STR_NULLPAD_TOKEN;}
-#line 1795 "hl/src//H5LTparse.c"
+#line 1820 "hl/src//H5LTparse.c"
break;
- case 80: /* strpad: H5T_STR_SPACEPAD_TOKEN */
-#line 318 "hl/src//H5LTparse.y"
+ case 83: /* strpad: H5T_STR_SPACEPAD_TOKEN */
+#line 322 "hl/src//H5LTparse.y"
{(yyval.ival) = H5T_STR_SPACEPAD_TOKEN;}
-#line 1801 "hl/src//H5LTparse.c"
+#line 1826 "hl/src//H5LTparse.c"
break;
- case 81: /* cset: H5T_CSET_ASCII_TOKEN */
-#line 320 "hl/src//H5LTparse.y"
+ case 84: /* cset: H5T_CSET_ASCII_TOKEN */
+#line 324 "hl/src//H5LTparse.y"
{(yyval.ival) = H5T_CSET_ASCII_TOKEN;}
-#line 1807 "hl/src//H5LTparse.c"
+#line 1832 "hl/src//H5LTparse.c"
break;
- case 82: /* cset: H5T_CSET_UTF8_TOKEN */
-#line 321 "hl/src//H5LTparse.y"
+ case 85: /* cset: H5T_CSET_UTF8_TOKEN */
+#line 325 "hl/src//H5LTparse.y"
{(yyval.ival) = H5T_CSET_UTF8_TOKEN;}
-#line 1813 "hl/src//H5LTparse.c"
+#line 1838 "hl/src//H5LTparse.c"
break;
- case 83: /* ctype: H5T_C_S1_TOKEN */
-#line 323 "hl/src//H5LTparse.y"
+ case 86: /* ctype: H5T_C_S1_TOKEN */
+#line 327 "hl/src//H5LTparse.y"
{(yyval.hid) = H5T_C_S1_TOKEN;}
-#line 1819 "hl/src//H5LTparse.c"
+#line 1844 "hl/src//H5LTparse.c"
break;
- case 84: /* ctype: H5T_FORTRAN_S1_TOKEN */
-#line 324 "hl/src//H5LTparse.y"
+ case 87: /* ctype: H5T_FORTRAN_S1_TOKEN */
+#line 328 "hl/src//H5LTparse.y"
{(yyval.hid) = H5T_FORTRAN_S1_TOKEN;}
-#line 1825 "hl/src//H5LTparse.c"
+#line 1850 "hl/src//H5LTparse.c"
break;
- case 85: /* $@12: %empty */
-#line 328 "hl/src//H5LTparse.y"
+ case 88: /* $@12: %empty */
+#line 332 "hl/src//H5LTparse.y"
{ is_enum = 1; enum_id = H5Tenum_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); }
-#line 1831 "hl/src//H5LTparse.c"
+#line 1856 "hl/src//H5LTparse.c"
break;
- case 86: /* enum_type: H5T_ENUM_TOKEN '{' integer_type ';' $@12 enum_list '}' */
-#line 330 "hl/src//H5LTparse.y"
+ case 89: /* enum_type: H5T_ENUM_TOKEN '{' integer_type ';' $@12 enum_list '}' */
+#line 334 "hl/src//H5LTparse.y"
{ is_enum = 0; /*reset*/ (yyval.hid) = enum_id; }
-#line 1837 "hl/src//H5LTparse.c"
+#line 1862 "hl/src//H5LTparse.c"
break;
- case 89: /* $@13: %empty */
-#line 335 "hl/src//H5LTparse.y"
+ case 92: /* $@13: %empty */
+#line 339 "hl/src//H5LTparse.y"
{
is_enum_memb = 1; /*indicate member of enum*/
enum_memb_symbol = strdup(yylval.sval);
free(yylval.sval);
yylval.sval = NULL;
}
-#line 1848 "hl/src//H5LTparse.c"
+#line 1873 "hl/src//H5LTparse.c"
break;
- case 90: /* enum_def: enum_symbol $@13 enum_val ';' */
-#line 342 "hl/src//H5LTparse.y"
+ case 93: /* enum_def: enum_symbol $@13 enum_val ';' */
+#line 346 "hl/src//H5LTparse.y"
{
char char_val=(char)yylval.ival;
short short_val=(short)yylval.ival;
@@ -1922,11 +1947,11 @@ yyreduce:
H5Tclose(super);
H5Tclose(native);
}
-#line 1895 "hl/src//H5LTparse.c"
+#line 1920 "hl/src//H5LTparse.c"
break;
-#line 1899 "hl/src//H5LTparse.c"
+#line 1924 "hl/src//H5LTparse.c"
default: break;
}
diff --git a/hl/src/H5LTparse.h b/hl/src/H5LTparse.h
index 84c5fd0..be3c91f 100644
--- a/hl/src/H5LTparse.h
+++ b/hl/src/H5LTparse.h
@@ -81,35 +81,38 @@ extern int H5LTyydebug;
H5T_NATIVE_ULONG_TOKEN = 282, /* H5T_NATIVE_ULONG_TOKEN */
H5T_NATIVE_LLONG_TOKEN = 283, /* H5T_NATIVE_LLONG_TOKEN */
H5T_NATIVE_ULLONG_TOKEN = 284, /* H5T_NATIVE_ULLONG_TOKEN */
- H5T_IEEE_F32BE_TOKEN = 285, /* H5T_IEEE_F32BE_TOKEN */
- H5T_IEEE_F32LE_TOKEN = 286, /* H5T_IEEE_F32LE_TOKEN */
- H5T_IEEE_F64BE_TOKEN = 287, /* H5T_IEEE_F64BE_TOKEN */
- H5T_IEEE_F64LE_TOKEN = 288, /* H5T_IEEE_F64LE_TOKEN */
- H5T_NATIVE_FLOAT_TOKEN = 289, /* H5T_NATIVE_FLOAT_TOKEN */
- H5T_NATIVE_DOUBLE_TOKEN = 290, /* H5T_NATIVE_DOUBLE_TOKEN */
- H5T_NATIVE_LDOUBLE_TOKEN = 291, /* H5T_NATIVE_LDOUBLE_TOKEN */
- H5T_STRING_TOKEN = 292, /* H5T_STRING_TOKEN */
- STRSIZE_TOKEN = 293, /* STRSIZE_TOKEN */
- STRPAD_TOKEN = 294, /* STRPAD_TOKEN */
- CSET_TOKEN = 295, /* CSET_TOKEN */
- CTYPE_TOKEN = 296, /* CTYPE_TOKEN */
- H5T_VARIABLE_TOKEN = 297, /* H5T_VARIABLE_TOKEN */
- H5T_STR_NULLTERM_TOKEN = 298, /* H5T_STR_NULLTERM_TOKEN */
- H5T_STR_NULLPAD_TOKEN = 299, /* H5T_STR_NULLPAD_TOKEN */
- H5T_STR_SPACEPAD_TOKEN = 300, /* H5T_STR_SPACEPAD_TOKEN */
- H5T_CSET_ASCII_TOKEN = 301, /* H5T_CSET_ASCII_TOKEN */
- H5T_CSET_UTF8_TOKEN = 302, /* H5T_CSET_UTF8_TOKEN */
- H5T_C_S1_TOKEN = 303, /* H5T_C_S1_TOKEN */
- H5T_FORTRAN_S1_TOKEN = 304, /* H5T_FORTRAN_S1_TOKEN */
- H5T_OPAQUE_TOKEN = 305, /* H5T_OPAQUE_TOKEN */
- OPQ_SIZE_TOKEN = 306, /* OPQ_SIZE_TOKEN */
- OPQ_TAG_TOKEN = 307, /* OPQ_TAG_TOKEN */
- H5T_COMPOUND_TOKEN = 308, /* H5T_COMPOUND_TOKEN */
- H5T_ENUM_TOKEN = 309, /* H5T_ENUM_TOKEN */
- H5T_ARRAY_TOKEN = 310, /* H5T_ARRAY_TOKEN */
- H5T_VLEN_TOKEN = 311, /* H5T_VLEN_TOKEN */
- STRING = 312, /* STRING */
- NUMBER = 313 /* NUMBER */
+ H5T_IEEE_F16BE_TOKEN = 285, /* H5T_IEEE_F16BE_TOKEN */
+ H5T_IEEE_F16LE_TOKEN = 286, /* H5T_IEEE_F16LE_TOKEN */
+ H5T_IEEE_F32BE_TOKEN = 287, /* H5T_IEEE_F32BE_TOKEN */
+ H5T_IEEE_F32LE_TOKEN = 288, /* H5T_IEEE_F32LE_TOKEN */
+ H5T_IEEE_F64BE_TOKEN = 289, /* H5T_IEEE_F64BE_TOKEN */
+ H5T_IEEE_F64LE_TOKEN = 290, /* H5T_IEEE_F64LE_TOKEN */
+ H5T_NATIVE_FLOAT16_TOKEN = 291, /* H5T_NATIVE_FLOAT16_TOKEN */
+ H5T_NATIVE_FLOAT_TOKEN = 292, /* H5T_NATIVE_FLOAT_TOKEN */
+ H5T_NATIVE_DOUBLE_TOKEN = 293, /* H5T_NATIVE_DOUBLE_TOKEN */
+ H5T_NATIVE_LDOUBLE_TOKEN = 294, /* H5T_NATIVE_LDOUBLE_TOKEN */
+ H5T_STRING_TOKEN = 295, /* H5T_STRING_TOKEN */
+ STRSIZE_TOKEN = 296, /* STRSIZE_TOKEN */
+ STRPAD_TOKEN = 297, /* STRPAD_TOKEN */
+ CSET_TOKEN = 298, /* CSET_TOKEN */
+ CTYPE_TOKEN = 299, /* CTYPE_TOKEN */
+ H5T_VARIABLE_TOKEN = 300, /* H5T_VARIABLE_TOKEN */
+ H5T_STR_NULLTERM_TOKEN = 301, /* H5T_STR_NULLTERM_TOKEN */
+ H5T_STR_NULLPAD_TOKEN = 302, /* H5T_STR_NULLPAD_TOKEN */
+ H5T_STR_SPACEPAD_TOKEN = 303, /* H5T_STR_SPACEPAD_TOKEN */
+ H5T_CSET_ASCII_TOKEN = 304, /* H5T_CSET_ASCII_TOKEN */
+ H5T_CSET_UTF8_TOKEN = 305, /* H5T_CSET_UTF8_TOKEN */
+ H5T_C_S1_TOKEN = 306, /* H5T_C_S1_TOKEN */
+ H5T_FORTRAN_S1_TOKEN = 307, /* H5T_FORTRAN_S1_TOKEN */
+ H5T_OPAQUE_TOKEN = 308, /* H5T_OPAQUE_TOKEN */
+ OPQ_SIZE_TOKEN = 309, /* OPQ_SIZE_TOKEN */
+ OPQ_TAG_TOKEN = 310, /* OPQ_TAG_TOKEN */
+ H5T_COMPOUND_TOKEN = 311, /* H5T_COMPOUND_TOKEN */
+ H5T_ENUM_TOKEN = 312, /* H5T_ENUM_TOKEN */
+ H5T_ARRAY_TOKEN = 313, /* H5T_ARRAY_TOKEN */
+ H5T_VLEN_TOKEN = 314, /* H5T_VLEN_TOKEN */
+ STRING = 315, /* STRING */
+ NUMBER = 316 /* NUMBER */
};
typedef enum yytokentype yytoken_kind_t;
#endif
@@ -124,7 +127,7 @@ union YYSTYPE
char *sval; /*for name string*/
hid_t hid; /*for hid_t token*/
-#line 128 "hl/src//H5LTparse.h"
+#line 131 "hl/src//H5LTparse.h"
};
typedef union YYSTYPE YYSTYPE;
diff --git a/hl/src/H5LTparse.y b/hl/src/H5LTparse.y
index 8621836..3a14e76 100644
--- a/hl/src/H5LTparse.y
+++ b/hl/src/H5LTparse.y
@@ -79,8 +79,9 @@ static char* enum_memb_symbol; /*enum member symbol string*/
%token <hid> H5T_NATIVE_SHORT_TOKEN H5T_NATIVE_USHORT_TOKEN H5T_NATIVE_INT_TOKEN H5T_NATIVE_UINT_TOKEN
%token <hid> H5T_NATIVE_LONG_TOKEN H5T_NATIVE_ULONG_TOKEN H5T_NATIVE_LLONG_TOKEN H5T_NATIVE_ULLONG_TOKEN
+%token <hid> H5T_IEEE_F16BE_TOKEN H5T_IEEE_F16LE_TOKEN
%token <hid> H5T_IEEE_F32BE_TOKEN H5T_IEEE_F32LE_TOKEN H5T_IEEE_F64BE_TOKEN H5T_IEEE_F64LE_TOKEN
-%token <hid> H5T_NATIVE_FLOAT_TOKEN H5T_NATIVE_DOUBLE_TOKEN H5T_NATIVE_LDOUBLE_TOKEN
+%token <hid> H5T_NATIVE_FLOAT16_TOKEN H5T_NATIVE_FLOAT_TOKEN H5T_NATIVE_DOUBLE_TOKEN H5T_NATIVE_LDOUBLE_TOKEN
%token <ival> H5T_STRING_TOKEN STRSIZE_TOKEN STRPAD_TOKEN CSET_TOKEN CTYPE_TOKEN H5T_VARIABLE_TOKEN
%token <ival> H5T_STR_NULLTERM_TOKEN H5T_STR_NULLPAD_TOKEN H5T_STR_SPACEPAD_TOKEN
@@ -142,10 +143,13 @@ integer_type : H5T_STD_I8BE_TOKEN { $<hid>$ = H5Tcopy(H5T_STD_I8BE); }
| H5T_NATIVE_ULLONG_TOKEN { $<hid>$ = H5Tcopy(H5T_NATIVE_ULLONG); }
;
-fp_type : H5T_IEEE_F32BE_TOKEN { $<hid>$ = H5Tcopy(H5T_IEEE_F32BE); }
+fp_type : H5T_IEEE_F16BE_TOKEN { $<hid>$ = H5Tcopy(H5T_IEEE_F16BE); }
+ | H5T_IEEE_F16LE_TOKEN { $<hid>$ = H5Tcopy(H5T_IEEE_F16LE); }
+ | H5T_IEEE_F32BE_TOKEN { $<hid>$ = H5Tcopy(H5T_IEEE_F32BE); }
| H5T_IEEE_F32LE_TOKEN { $<hid>$ = H5Tcopy(H5T_IEEE_F32LE); }
| H5T_IEEE_F64BE_TOKEN { $<hid>$ = H5Tcopy(H5T_IEEE_F64BE); }
| H5T_IEEE_F64LE_TOKEN { $<hid>$ = H5Tcopy(H5T_IEEE_F64LE); }
+ | H5T_NATIVE_FLOAT16_TOKEN { $<hid>$ = H5Tcopy(H5T_NATIVE_FLOAT16); }
| H5T_NATIVE_FLOAT_TOKEN { $<hid>$ = H5Tcopy(H5T_NATIVE_FLOAT); }
| H5T_NATIVE_DOUBLE_TOKEN { $<hid>$ = H5Tcopy(H5T_NATIVE_DOUBLE); }
| H5T_NATIVE_LDOUBLE_TOKEN { $<hid>$ = H5Tcopy(H5T_NATIVE_LDOUBLE); }
diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java
index 25b65fa..55b6f4b 100644
--- a/java/src/hdf/hdf5lib/HDF5Constants.java
+++ b/java/src/hdf/hdf5lib/HDF5Constants.java
@@ -1095,6 +1095,10 @@ public class HDF5Constants {
/** */
public static final long H5T_FORTRAN_S1 = H5T_FORTRAN_S1();
/** */
+ public static final long H5T_IEEE_F16BE = H5T_IEEE_F16BE();
+ /** */
+ public static final long H5T_IEEE_F16LE = H5T_IEEE_F16LE();
+ /** */
public static final long H5T_IEEE_F32BE = H5T_IEEE_F32BE();
/** */
public static final long H5T_IEEE_F32LE = H5T_IEEE_F32LE();
@@ -1175,6 +1179,8 @@ public class HDF5Constants {
/** */
public static final long H5T_NATIVE_FLOAT = H5T_NATIVE_FLOAT();
/** */
+ public static final long H5T_NATIVE_FLOAT16 = H5T_NATIVE_FLOAT16();
+ /** */
public static final long H5T_NATIVE_HADDR = H5T_NATIVE_HADDR();
/** */
public static final long H5T_NATIVE_HBOOL = H5T_NATIVE_HBOOL();
@@ -2580,6 +2586,10 @@ public class HDF5Constants {
private static native final long H5T_FORTRAN_S1();
+ private static native final long H5T_IEEE_F16BE();
+
+ private static native final long H5T_IEEE_F16LE();
+
private static native final long H5T_IEEE_F32BE();
private static native final long H5T_IEEE_F32LE();
@@ -2660,6 +2670,8 @@ public class HDF5Constants {
private static native final long H5T_NATIVE_FLOAT();
+ private static native final long H5T_NATIVE_FLOAT16();
+
private static native final long H5T_NATIVE_HADDR();
private static native final long H5T_NATIVE_HBOOL();
diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c
index d83b462..ee1bd5a 100644
--- a/java/src/jni/h5Constants.c
+++ b/java/src/jni/h5Constants.c
@@ -2678,6 +2678,16 @@ Java_hdf_hdf5lib_HDF5Constants_H5T_1FORTRAN_1S1(JNIEnv *env, jclass cls)
return H5T_FORTRAN_S1;
}
JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5T_1IEEE_1F16BE(JNIEnv *env, jclass cls)
+{
+ return H5T_IEEE_F16BE;
+}
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5T_1IEEE_1F16LE(JNIEnv *env, jclass cls)
+{
+ return H5T_IEEE_F16LE;
+}
+JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5T_1IEEE_1F32BE(JNIEnv *env, jclass cls)
{
return H5T_IEEE_F32BE;
@@ -2878,6 +2888,11 @@ Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1FLOAT(JNIEnv *env, jclass cls)
return H5T_NATIVE_FLOAT;
}
JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1FLOAT16(JNIEnv *env, jclass cls)
+{
+ return H5T_NATIVE_FLOAT16;
+}
+JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1HADDR(JNIEnv *env, jclass cls)
{
return H5T_NATIVE_HADDR;
diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c
index bf798b8..d10ab83 100644
--- a/java/src/jni/h5util.c
+++ b/java/src/jni/h5util.c
@@ -2082,7 +2082,9 @@ h5str_get_little_endian_type(hid_t tid)
}
case H5T_FLOAT: {
- if (size == 4)
+ if (size == 2)
+ p_type = H5Tcopy(H5T_IEEE_F16LE);
+ else if (size == 4)
p_type = H5Tcopy(H5T_IEEE_F32LE);
else if (size == 8)
p_type = H5Tcopy(H5T_IEEE_F64LE);
@@ -2176,7 +2178,9 @@ h5str_get_big_endian_type(hid_t tid)
}
case H5T_FLOAT: {
- if (size == 4)
+ if (size == 2)
+ p_type = H5Tcopy(H5T_IEEE_F16BE);
+ else if (size == 4)
p_type = H5Tcopy(H5T_IEEE_F32BE);
else if (size == 8)
p_type = H5Tcopy(H5T_IEEE_F64BE);
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 2d8eb32..bb0448e 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -368,6 +368,78 @@ New Features
Library:
--------
+ - Added support for _Float16 16-bit half-precision floating-point datatype
+
+ Support for the _Float16 C datatype has been added on platforms where:
+
+ - The _Float16 datatype and its associated macros (FLT16_MIN, FLT16_MAX,
+ FLT16_EPSILON, etc.) are available
+ - A simple test program that converts between the _Float16 datatype and
+ other datatypes with casts can be successfully compiled and run at
+ configure time. Some compilers appear to be buggy or feature-incomplete
+ in this regard and will generate calls to compiler-internal functions
+ for converting between the _Float16 datatype and other datatypes, but
+ will not link these functions into the build, resulting in build
+ failures.
+
+ The following new macros have been added:
+
+ H5_HAVE__FLOAT16 - This macro is defined in H5pubconf.h and will have
+ the value 1 if support for the _Float16 datatype is
+ available. It will not be defined otherwise.
+
+ H5_SIZEOF__FLOAT16 - This macro is defined in H5pubconf.h and will have
+ a value corresponding to the size of the _Float16
+ datatype, as computed by sizeof(). It will have the
+ value 0 if support for the _Float16 datatype is not
+ available.
+
+ H5_HAVE_FABSF16 - This macro is defined in H5pubconf.h and will have the
+ value 1 if the fabsf16 function is available for use.
+
+ H5_LDOUBLE_TO_FLOAT16_CORRECT - This macro is defined in H5pubconf.h and
+ will have the value 1 if the platform can
+ correctly convert long double values to
+ _Float16. Some compilers have issues with
+ this.
+
+ H5T_NATIVE_FLOAT16 - This macro maps to the ID of an HDF5 datatype representing
+ the native C _Float16 datatype for the platform. If
+ support for the _Float16 datatype is not available, the
+ macro will map to H5I_INVALID_HID and should not be used.
+
+ H5T_IEEE_F16BE - This macro maps to the ID of an HDF5 datatype representing
+ a big-endian IEEE 754 16-bit floating-point datatype. This
+ datatype is available regardless of whether _Float16 support
+ is available or not.
+
+ H5T_IEEE_F16LE - This macro maps to the ID of an HDF5 datatype representing
+ a little-endian IEEE 754 16-bit floating-point datatype.
+ This datatype is available regardless of whether _Float16
+ support is available or not.
+
+ The following new hard datatype conversion paths have been added, but
+ will only be used when _Float16 support is available:
+
+ H5T_NATIVE_SCHAR <-> H5T_NATIVE_FLOAT16 | H5T_NATIVE_UCHAR <-> H5T_NATIVE_FLOAT16
+ H5T_NATIVE_SHORT <-> H5T_NATIVE_FLOAT16 | H5T_NATIVE_USHORT <-> H5T_NATIVE_FLOAT16
+ H5T_NATIVE_INT <-> H5T_NATIVE_FLOAT16 | H5T_NATIVE_UINT <-> H5T_NATIVE_FLOAT16
+ H5T_NATIVE_LONG <-> H5T_NATIVE_FLOAT16 | H5T_NATIVE_ULONG <-> H5T_NATIVE_FLOAT16
+ H5T_NATIVE_LLONG <-> H5T_NATIVE_FLOAT16 | H5T_NATIVE_ULLONG <-> H5T_NATIVE_FLOAT16
+ H5T_NATIVE_FLOAT <-> H5T_NATIVE_FLOAT16 | H5T_NATIVE_DOUBLE <-> H5T_NATIVE_FLOAT16
+ H5T_NATIVE_LDOUBLE <-> H5T_NATIVE_FLOAT16
+
+ The H5T_NATIVE_LDOUBLE -> H5T_NATIVE_FLOAT16 hard conversion path will only
+ be available and used if H5_LDOUBLE_TO_FLOAT16_CORRECT has a value of 1. Otherwise,
+ the conversion will be emulated in software by the library.
+
+ Note that in the absence of any compiler flags for architecture-specific
+ tuning, the generated code for datatype conversions with the _Float16 type
+ may perform conversions by first promoting the type to float. Use of
+ architecture-specific tuning compiler flags may instead allow for the
+ generation of specialized instructions, such as AVX512-FP16 instructions,
+ if available.
+
- Implemented optimized support for vector I/O in the Subfiling VFD
Previously, the Subfiling VFD would handle vector I/O requests by
@@ -591,6 +663,42 @@ Bug Fixes since HDF5-1.14.0 release
Library
-------
+ - Fixed a bug that causes the library to incorrectly identify
+ the endian-ness of 16-bit and smaller C floating-point datatypes
+
+ When detecting the endian-ness of an in-memory C floating-point
+ datatype, the library previously always assumed that the type
+ was at least 32 bits in size. This resulted in invalid memory
+ accesses and would usually cause the library to identify the
+ datatype as having an endian-ness of H5T_ORDER_VAX. This has
+ now been fixed.
+
+ - Fixed a bug that causes an invalid memory access issue when
+ converting 16-bit floating-point values to integers with the
+ library's software conversion function
+
+ The H5T__conv_f_i function previously always assumed that
+ floating-point values were at least 32 bits in size and would
+ access invalid memory when attempting to convert 16-bit
+ floating-point values to integers. To fix this, parts of the
+ H5T__conv_f_i function had to be rewritten, which also resulted
+ in a significant speedup when converting floating-point values
+ to integers where the library does not have a hard conversion
+ path. This is the case for any floating-point values with a
+ datatype not represented by H5T_NATIVE_FLOAT16 (if _Float16 is
+ supported), H5T_NATIVE_FLOAT, H5T_NATIVE_DOUBLE or
+ H5T_NATIVE_LDOUBLE.
+
+ - Fixed a bug that can cause incorrect data when overflows occur
+ while converting integer values to floating-point values with
+ the library's software conversion function
+
+ The H5T__conv_i_f function had a bug which previously caused it
+ to return incorrect data when an overflow occurs and an application's
+ conversion exception callback function decides not to handle the
+ overflow. Rather than return positive infinity, the library would
+ return truncated data. This has now been fixed.
+
- Fixed error when overwriting certain nested variable length types
Previously, when using a datatype that included a variable length type
@@ -1330,6 +1438,17 @@ Bug Fixes since HDF5-1.14.0 release
Testing
-------
+ - Fixed a bug in the dt_arith test when H5_WANT_DCONV_EXCEPTION is not
+ defined
+
+ The dt_arith test program's test_particular_fp_integer sub-test tries
+ to ensure that the library correctly raises a datatype conversion
+ exception when converting a floating-point value to an integer overflows.
+ However, this test would run even when H5_WANT_DCONV_EXCEPTION isn't
+ defined, causing the test to fail due to the library not raising
+ datatype conversion exceptions. This has now been fixed by not running
+ the test when H5_WANT_DCONV_EXCEPTION is not defined.
+
- Disabled running of MPI Atomicity tests for OpenMPI major versions < 5
Support for MPI atomicity operations is not implemented for major
diff --git a/src/H5Fmodule.h b/src/H5Fmodule.h
index bf54976..098e703 100644
--- a/src/H5Fmodule.h
+++ b/src/H5Fmodule.h
@@ -239,7 +239,7 @@
* page under
* <a href="https://portal.hdfgroup.org/display/HDF5/Libraries+and+Tools+Reference">
* Libraries and Tools Reference</a>.
- * The HDF5 DDL grammar is described in the document \ref DDLBNF110.
+ * The HDF5 DDL grammar is described in the document \ref DDLBNF114.
*
* \subsection subsec_file_summary File Function Summaries
* General library (\ref H5 functions and macros), (\ref H5F functions), file related
diff --git a/src/H5Gmodule.h b/src/H5Gmodule.h
index c330fcd..fb9cf73 100644
--- a/src/H5Gmodule.h
+++ b/src/H5Gmodule.h
@@ -343,7 +343,7 @@
*
* h5dump is described on the “HDF5 Tools” page of the \ref RM.
*
- * The HDF5 DDL grammar is described in the @ref DDLBNF110.
+ * The HDF5 DDL grammar is described in the @ref DDLBNF114.
*
* \subsection subsec_group_function Group Function Summaries
* Functions that can be used with groups (\ref H5G functions) and property list functions that can used
diff --git a/src/H5T.c b/src/H5T.c
index 7d3db70..1fb4b21 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -100,6 +100,30 @@
dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; \
}
+/* Define the code templates for standard 16-bit floats for the "GUTS" in the H5T_INIT_TYPE macro */
+#define H5T_INIT_TYPE_FLOAT16_COMMON(ENDIANNESS) \
+ { \
+ H5T_INIT_TYPE_NUM_COMMON(ENDIANNESS) \
+ dt->shared->u.atomic.u.f.sign = 15; \
+ dt->shared->u.atomic.u.f.epos = 10; \
+ dt->shared->u.atomic.u.f.esize = 5; \
+ dt->shared->u.atomic.u.f.ebias = 0xf; \
+ dt->shared->u.atomic.u.f.mpos = 0; \
+ dt->shared->u.atomic.u.f.msize = 10; \
+ dt->shared->u.atomic.u.f.norm = H5T_NORM_IMPLIED; \
+ dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO; \
+ }
+
+#define H5T_INIT_TYPE_FLOAT16LE_CORE \
+ { \
+ H5T_INIT_TYPE_FLOAT16_COMMON(H5T_ORDER_LE) \
+ }
+
+#define H5T_INIT_TYPE_FLOAT16BE_CORE \
+ { \
+ H5T_INIT_TYPE_FLOAT16_COMMON(H5T_ORDER_BE) \
+ }
+
/* Define the code templates for standard floats for the "GUTS" in the H5T_INIT_TYPE macro */
#define H5T_INIT_TYPE_FLOAT_COMMON(ENDIANNESS) \
{ \
@@ -375,102 +399,105 @@ H5T_order_t H5T_native_order_g = H5T_ORDER_ERROR;
* If more of these are added, the new ones must be added to the list of
* types to reset in H5T_term_package().
*/
-hid_t H5T_IEEE_F32BE_g = FAIL;
-hid_t H5T_IEEE_F32LE_g = FAIL;
-hid_t H5T_IEEE_F64BE_g = FAIL;
-hid_t H5T_IEEE_F64LE_g = FAIL;
-
-hid_t H5T_VAX_F32_g = FAIL;
-hid_t H5T_VAX_F64_g = FAIL;
-
-hid_t H5T_STD_I8BE_g = FAIL;
-hid_t H5T_STD_I8LE_g = FAIL;
-hid_t H5T_STD_I16BE_g = FAIL;
-hid_t H5T_STD_I16LE_g = FAIL;
-hid_t H5T_STD_I32BE_g = FAIL;
-hid_t H5T_STD_I32LE_g = FAIL;
-hid_t H5T_STD_I64BE_g = FAIL;
-hid_t H5T_STD_I64LE_g = FAIL;
-hid_t H5T_STD_U8BE_g = FAIL;
-hid_t H5T_STD_U8LE_g = FAIL;
-hid_t H5T_STD_U16BE_g = FAIL;
-hid_t H5T_STD_U16LE_g = FAIL;
-hid_t H5T_STD_U32BE_g = FAIL;
-hid_t H5T_STD_U32LE_g = FAIL;
-hid_t H5T_STD_U64BE_g = FAIL;
-hid_t H5T_STD_U64LE_g = FAIL;
-hid_t H5T_STD_B8BE_g = FAIL;
-hid_t H5T_STD_B8LE_g = FAIL;
-hid_t H5T_STD_B16BE_g = FAIL;
-hid_t H5T_STD_B16LE_g = FAIL;
-hid_t H5T_STD_B32BE_g = FAIL;
-hid_t H5T_STD_B32LE_g = FAIL;
-hid_t H5T_STD_B64BE_g = FAIL;
-hid_t H5T_STD_B64LE_g = FAIL;
-hid_t H5T_STD_REF_OBJ_g = FAIL;
-hid_t H5T_STD_REF_DSETREG_g = FAIL;
-hid_t H5T_STD_REF_g = FAIL;
-
-hid_t H5T_UNIX_D32BE_g = FAIL;
-hid_t H5T_UNIX_D32LE_g = FAIL;
-hid_t H5T_UNIX_D64BE_g = FAIL;
-hid_t H5T_UNIX_D64LE_g = FAIL;
-
-hid_t H5T_C_S1_g = FAIL;
-
-hid_t H5T_FORTRAN_S1_g = FAIL;
-
-hid_t H5T_NATIVE_SCHAR_g = FAIL;
-hid_t H5T_NATIVE_UCHAR_g = FAIL;
-hid_t H5T_NATIVE_SHORT_g = FAIL;
-hid_t H5T_NATIVE_USHORT_g = FAIL;
-hid_t H5T_NATIVE_INT_g = FAIL;
-hid_t H5T_NATIVE_UINT_g = FAIL;
-hid_t H5T_NATIVE_LONG_g = FAIL;
-hid_t H5T_NATIVE_ULONG_g = FAIL;
-hid_t H5T_NATIVE_LLONG_g = FAIL;
-hid_t H5T_NATIVE_ULLONG_g = FAIL;
-hid_t H5T_NATIVE_FLOAT_g = FAIL;
-hid_t H5T_NATIVE_DOUBLE_g = FAIL;
-hid_t H5T_NATIVE_LDOUBLE_g = FAIL;
-hid_t H5T_NATIVE_B8_g = FAIL;
-hid_t H5T_NATIVE_B16_g = FAIL;
-hid_t H5T_NATIVE_B32_g = FAIL;
-hid_t H5T_NATIVE_B64_g = FAIL;
-hid_t H5T_NATIVE_OPAQUE_g = FAIL;
-hid_t H5T_NATIVE_HADDR_g = FAIL;
-hid_t H5T_NATIVE_HSIZE_g = FAIL;
-hid_t H5T_NATIVE_HSSIZE_g = FAIL;
-hid_t H5T_NATIVE_HERR_g = FAIL;
-hid_t H5T_NATIVE_HBOOL_g = FAIL;
-
-hid_t H5T_NATIVE_INT8_g = FAIL;
-hid_t H5T_NATIVE_UINT8_g = FAIL;
-hid_t H5T_NATIVE_INT_LEAST8_g = FAIL;
-hid_t H5T_NATIVE_UINT_LEAST8_g = FAIL;
-hid_t H5T_NATIVE_INT_FAST8_g = FAIL;
-hid_t H5T_NATIVE_UINT_FAST8_g = FAIL;
-
-hid_t H5T_NATIVE_INT16_g = FAIL;
-hid_t H5T_NATIVE_UINT16_g = FAIL;
-hid_t H5T_NATIVE_INT_LEAST16_g = FAIL;
-hid_t H5T_NATIVE_UINT_LEAST16_g = FAIL;
-hid_t H5T_NATIVE_INT_FAST16_g = FAIL;
-hid_t H5T_NATIVE_UINT_FAST16_g = FAIL;
-
-hid_t H5T_NATIVE_INT32_g = FAIL;
-hid_t H5T_NATIVE_UINT32_g = FAIL;
-hid_t H5T_NATIVE_INT_LEAST32_g = FAIL;
-hid_t H5T_NATIVE_UINT_LEAST32_g = FAIL;
-hid_t H5T_NATIVE_INT_FAST32_g = FAIL;
-hid_t H5T_NATIVE_UINT_FAST32_g = FAIL;
-
-hid_t H5T_NATIVE_INT64_g = FAIL;
-hid_t H5T_NATIVE_UINT64_g = FAIL;
-hid_t H5T_NATIVE_INT_LEAST64_g = FAIL;
-hid_t H5T_NATIVE_UINT_LEAST64_g = FAIL;
-hid_t H5T_NATIVE_INT_FAST64_g = FAIL;
-hid_t H5T_NATIVE_UINT_FAST64_g = FAIL;
+hid_t H5T_IEEE_F16BE_g = H5I_INVALID_HID;
+hid_t H5T_IEEE_F16LE_g = H5I_INVALID_HID;
+hid_t H5T_IEEE_F32BE_g = H5I_INVALID_HID;
+hid_t H5T_IEEE_F32LE_g = H5I_INVALID_HID;
+hid_t H5T_IEEE_F64BE_g = H5I_INVALID_HID;
+hid_t H5T_IEEE_F64LE_g = H5I_INVALID_HID;
+
+hid_t H5T_VAX_F32_g = H5I_INVALID_HID;
+hid_t H5T_VAX_F64_g = H5I_INVALID_HID;
+
+hid_t H5T_STD_I8BE_g = H5I_INVALID_HID;
+hid_t H5T_STD_I8LE_g = H5I_INVALID_HID;
+hid_t H5T_STD_I16BE_g = H5I_INVALID_HID;
+hid_t H5T_STD_I16LE_g = H5I_INVALID_HID;
+hid_t H5T_STD_I32BE_g = H5I_INVALID_HID;
+hid_t H5T_STD_I32LE_g = H5I_INVALID_HID;
+hid_t H5T_STD_I64BE_g = H5I_INVALID_HID;
+hid_t H5T_STD_I64LE_g = H5I_INVALID_HID;
+hid_t H5T_STD_U8BE_g = H5I_INVALID_HID;
+hid_t H5T_STD_U8LE_g = H5I_INVALID_HID;
+hid_t H5T_STD_U16BE_g = H5I_INVALID_HID;
+hid_t H5T_STD_U16LE_g = H5I_INVALID_HID;
+hid_t H5T_STD_U32BE_g = H5I_INVALID_HID;
+hid_t H5T_STD_U32LE_g = H5I_INVALID_HID;
+hid_t H5T_STD_U64BE_g = H5I_INVALID_HID;
+hid_t H5T_STD_U64LE_g = H5I_INVALID_HID;
+hid_t H5T_STD_B8BE_g = H5I_INVALID_HID;
+hid_t H5T_STD_B8LE_g = H5I_INVALID_HID;
+hid_t H5T_STD_B16BE_g = H5I_INVALID_HID;
+hid_t H5T_STD_B16LE_g = H5I_INVALID_HID;
+hid_t H5T_STD_B32BE_g = H5I_INVALID_HID;
+hid_t H5T_STD_B32LE_g = H5I_INVALID_HID;
+hid_t H5T_STD_B64BE_g = H5I_INVALID_HID;
+hid_t H5T_STD_B64LE_g = H5I_INVALID_HID;
+hid_t H5T_STD_REF_OBJ_g = H5I_INVALID_HID;
+hid_t H5T_STD_REF_DSETREG_g = H5I_INVALID_HID;
+hid_t H5T_STD_REF_g = H5I_INVALID_HID;
+
+hid_t H5T_UNIX_D32BE_g = H5I_INVALID_HID;
+hid_t H5T_UNIX_D32LE_g = H5I_INVALID_HID;
+hid_t H5T_UNIX_D64BE_g = H5I_INVALID_HID;
+hid_t H5T_UNIX_D64LE_g = H5I_INVALID_HID;
+
+hid_t H5T_C_S1_g = H5I_INVALID_HID;
+
+hid_t H5T_FORTRAN_S1_g = H5I_INVALID_HID;
+
+hid_t H5T_NATIVE_SCHAR_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_UCHAR_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_SHORT_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_USHORT_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_INT_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_UINT_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_LONG_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_ULONG_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_LLONG_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_ULLONG_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_FLOAT16_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_FLOAT_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_DOUBLE_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_LDOUBLE_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_B8_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_B16_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_B32_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_B64_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_OPAQUE_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_HADDR_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_HSIZE_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_HSSIZE_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_HERR_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_HBOOL_g = H5I_INVALID_HID;
+
+hid_t H5T_NATIVE_INT8_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_UINT8_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_INT_LEAST8_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_UINT_LEAST8_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_INT_FAST8_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_UINT_FAST8_g = H5I_INVALID_HID;
+
+hid_t H5T_NATIVE_INT16_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_UINT16_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_INT_LEAST16_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_UINT_LEAST16_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_INT_FAST16_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_UINT_FAST16_g = H5I_INVALID_HID;
+
+hid_t H5T_NATIVE_INT32_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_UINT32_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_INT_LEAST32_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_UINT_LEAST32_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_INT_FAST32_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_UINT_FAST32_g = H5I_INVALID_HID;
+
+hid_t H5T_NATIVE_INT64_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_UINT64_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_INT_LEAST64_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_UINT_LEAST64_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_INT_FAST64_g = H5I_INVALID_HID;
+hid_t H5T_NATIVE_UINT_FAST64_g = H5I_INVALID_HID;
/*
* Alignment constraints for HDF5 types. Accessing objects of these
@@ -498,6 +525,7 @@ size_t H5T_NATIVE_LONG_ALIGN_g = 0;
size_t H5T_NATIVE_ULONG_ALIGN_g = 0;
size_t H5T_NATIVE_LLONG_ALIGN_g = 0;
size_t H5T_NATIVE_ULLONG_ALIGN_g = 0;
+size_t H5T_NATIVE_FLOAT16_ALIGN_g = 0;
size_t H5T_NATIVE_FLOAT_ALIGN_g = 0;
size_t H5T_NATIVE_DOUBLE_ALIGN_g = 0;
size_t H5T_NATIVE_LDOUBLE_ALIGN_g = 0;
@@ -533,6 +561,15 @@ size_t H5T_NATIVE_UINT_FAST64_ALIGN_g = 0;
/* Useful floating-point values for conversion routines */
/* (+/- Inf for all floating-point types) */
+#ifdef H5_HAVE__FLOAT16
+/* Initialize these with a float literal since the f16 suffix
+ * is non-standard C and gives warnings when compiling the
+ * library with the -pedantic flag. These values will be
+ * overwritten anyway.
+ */
+H5__Float16 H5T_NATIVE_FLOAT16_POS_INF_g = 0.0f;
+H5__Float16 H5T_NATIVE_FLOAT16_NEG_INF_g = 0.0f;
+#endif
float H5T_NATIVE_FLOAT_POS_INF_g = 0.0F;
float H5T_NATIVE_FLOAT_NEG_INF_g = 0.0F;
double H5T_NATIVE_DOUBLE_POS_INF_g = 0.0;
@@ -685,6 +722,49 @@ H5T__init_inf(void)
} /* end for */
} /* end if */
+#ifdef H5_HAVE__FLOAT16
+ /* Get the _Float16 datatype */
+ if (NULL == (dst_p = (H5T_t *)H5I_object(H5T_NATIVE_FLOAT16_g)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype");
+ dst = &dst_p->shared->u.atomic;
+
+ /* Check that we can re-order the bytes correctly */
+ if (H5T_ORDER_LE != H5T_native_order_g && H5T_ORDER_BE != H5T_native_order_g)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order");
+
+ /* +Inf */
+ d = (uint8_t *)&H5T_NATIVE_FLOAT16_POS_INF_g;
+ H5T__bit_set(d, dst->u.f.sign, (size_t)1, false);
+ H5T__bit_set(d, dst->u.f.epos, dst->u.f.esize, true);
+ H5T__bit_set(d, dst->u.f.mpos, dst->u.f.msize, false);
+
+ /* Swap the bytes if the machine architecture is big-endian */
+ if (H5T_ORDER_BE == H5T_native_order_g) {
+ half_size = dst_p->shared->size / 2;
+ for (u = 0; u < half_size; u++) {
+ uint8_t tmp = d[dst_p->shared->size - (u + 1)];
+ d[dst_p->shared->size - (u + 1)] = d[u];
+ d[u] = tmp;
+ } /* end for */
+ } /* end if */
+
+ /* -Inf */
+ d = (uint8_t *)&H5T_NATIVE_FLOAT16_NEG_INF_g;
+ H5T__bit_set(d, dst->u.f.sign, (size_t)1, true);
+ H5T__bit_set(d, dst->u.f.epos, dst->u.f.esize, true);
+ H5T__bit_set(d, dst->u.f.mpos, dst->u.f.msize, false);
+
+ /* Swap the bytes if the machine architecture is big-endian */
+ if (H5T_ORDER_BE == H5T_native_order_g) {
+ half_size = dst_p->shared->size / 2;
+ for (u = 0; u < half_size; u++) {
+ uint8_t tmp = d[dst_p->shared->size - (u + 1)];
+ d[dst_p->shared->size - (u + 1)] = d[u];
+ d[u] = tmp;
+ } /* end for */
+ } /* end if */
+#endif
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__init_inf() */
@@ -738,6 +818,9 @@ H5T_init(void)
herr_t status;
bool copied_dtype =
true; /* Flag to indicate whether datatype was copied or allocated (for error cleanup) */
+#ifdef H5_HAVE__FLOAT16
+ H5T_t *native_float16 = NULL; /* Datatype structure for native _Float16 type */
+#endif
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -779,6 +862,10 @@ H5T_init(void)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object");
if (NULL == (native_ullong = (H5T_t *)H5I_object(H5T_NATIVE_ULLONG_g)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object");
+#ifdef H5_HAVE__FLOAT16
+ if (NULL == (native_float16 = (H5T_t *)H5I_object(H5T_NATIVE_FLOAT16_g)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object");
+#endif
if (NULL == (native_float = (H5T_t *)H5I_object(H5T_NATIVE_FLOAT_g)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object");
if (NULL == (native_double = (H5T_t *)H5I_object(H5T_NATIVE_DOUBLE_g)))
@@ -823,6 +910,12 @@ H5T_init(void)
*------------------------------------------------------------
*/
+ /* IEEE 2-byte little-endian float */
+ H5T_INIT_TYPE(FLOAT16LE, H5T_IEEE_F16LE_g, COPY, native_double, SET, 2)
+
+ /* IEEE 2-byte big-endian float */
+ H5T_INIT_TYPE(FLOAT16BE, H5T_IEEE_F16BE_g, COPY, native_double, SET, 2)
+
/* IEEE 4-byte little-endian float */
H5T_INIT_TYPE(FLOATLE, H5T_IEEE_F32LE_g, COPY, native_double, SET, 4)
@@ -1062,6 +1155,22 @@ H5T_init(void)
H5T__register_int(H5T_PERS_HARD, "ldbl_flt", native_ldouble, native_float, H5T__conv_ldouble_float);
status |=
H5T__register_int(H5T_PERS_HARD, "ldbl_dbl", native_ldouble, native_double, H5T__conv_ldouble_double);
+#ifdef H5_HAVE__FLOAT16
+ status |=
+ H5T__register_int(H5T_PERS_HARD, "flt16_flt", native_float16, native_float, H5T__conv__Float16_float);
+ status |= H5T__register_int(H5T_PERS_HARD, "flt16_dbl", native_float16, native_double,
+ H5T__conv__Float16_double);
+ status |= H5T__register_int(H5T_PERS_HARD, "flt16_ldbl", native_float16, native_ldouble,
+ H5T__conv__Float16_ldouble);
+ status |=
+ H5T__register_int(H5T_PERS_HARD, "flt_flt16", native_float, native_float16, H5T__conv_float__Float16);
+ status |= H5T__register_int(H5T_PERS_HARD, "dbl_flt16", native_double, native_float16,
+ H5T__conv_double__Float16);
+#ifdef H5T_CONV_INTERNAL_LDOUBLE_FLOAT16
+ status |= H5T__register_int(H5T_PERS_HARD, "ldbl_flt16", native_ldouble, native_float16,
+ H5T__conv_ldouble__Float16);
+#endif
+#endif
/* from long long */
status |=
@@ -1220,6 +1329,10 @@ H5T_init(void)
H5T__register_int(H5T_PERS_HARD, "schar_dbl", native_schar, native_double, H5T__conv_schar_double);
status |=
H5T__register_int(H5T_PERS_HARD, "schar_ldbl", native_schar, native_ldouble, H5T__conv_schar_ldouble);
+#ifdef H5_HAVE__FLOAT16
+ status |= H5T__register_int(H5T_PERS_HARD, "schar_flt16", native_schar, native_float16,
+ H5T__conv_schar__Float16);
+#endif
/* From unsigned char to floats */
status |=
@@ -1228,6 +1341,10 @@ H5T_init(void)
H5T__register_int(H5T_PERS_HARD, "uchar_dbl", native_uchar, native_double, H5T__conv_uchar_double);
status |=
H5T__register_int(H5T_PERS_HARD, "uchar_ldbl", native_uchar, native_ldouble, H5T__conv_uchar_ldouble);
+#ifdef H5_HAVE__FLOAT16
+ status |= H5T__register_int(H5T_PERS_HARD, "uchar_flt16", native_uchar, native_float16,
+ H5T__conv_uchar__Float16);
+#endif
/* From short to floats */
status |=
@@ -1236,6 +1353,10 @@ H5T_init(void)
H5T__register_int(H5T_PERS_HARD, "short_dbl", native_short, native_double, H5T__conv_short_double);
status |=
H5T__register_int(H5T_PERS_HARD, "short_ldbl", native_short, native_ldouble, H5T__conv_short_ldouble);
+#ifdef H5_HAVE__FLOAT16
+ status |= H5T__register_int(H5T_PERS_HARD, "short_flt16", native_short, native_float16,
+ H5T__conv_short__Float16);
+#endif
/* From unsigned short to floats */
status |=
@@ -1244,23 +1365,39 @@ H5T_init(void)
H5T__register_int(H5T_PERS_HARD, "ushort_dbl", native_ushort, native_double, H5T__conv_ushort_double);
status |= H5T__register_int(H5T_PERS_HARD, "ushort_ldbl", native_ushort, native_ldouble,
H5T__conv_ushort_ldouble);
+#ifdef H5_HAVE__FLOAT16
+ status |= H5T__register_int(H5T_PERS_HARD, "ushort_flt16", native_ushort, native_float16,
+ H5T__conv_ushort__Float16);
+#endif
/* From int to floats */
status |= H5T__register_int(H5T_PERS_HARD, "int_flt", native_int, native_float, H5T__conv_int_float);
status |= H5T__register_int(H5T_PERS_HARD, "int_dbl", native_int, native_double, H5T__conv_int_double);
status |= H5T__register_int(H5T_PERS_HARD, "int_ldbl", native_int, native_ldouble, H5T__conv_int_ldouble);
+#ifdef H5_HAVE__FLOAT16
+ status |=
+ H5T__register_int(H5T_PERS_HARD, "int_flt16", native_int, native_float16, H5T__conv_int__Float16);
+#endif
/* From unsigned int to floats */
status |= H5T__register_int(H5T_PERS_HARD, "uint_flt", native_uint, native_float, H5T__conv_uint_float);
status |= H5T__register_int(H5T_PERS_HARD, "uint_dbl", native_uint, native_double, H5T__conv_uint_double);
status |=
H5T__register_int(H5T_PERS_HARD, "uint_ldbl", native_uint, native_ldouble, H5T__conv_uint_ldouble);
+#ifdef H5_HAVE__FLOAT16
+ status |=
+ H5T__register_int(H5T_PERS_HARD, "uint_flt16", native_uint, native_float16, H5T__conv_uint__Float16);
+#endif
/* From long to floats */
status |= H5T__register_int(H5T_PERS_HARD, "long_flt", native_long, native_float, H5T__conv_long_float);
status |= H5T__register_int(H5T_PERS_HARD, "long_dbl", native_long, native_double, H5T__conv_long_double);
status |=
H5T__register_int(H5T_PERS_HARD, "long_ldbl", native_long, native_ldouble, H5T__conv_long_ldouble);
+#ifdef H5_HAVE__FLOAT16
+ status |=
+ H5T__register_int(H5T_PERS_HARD, "long_flt16", native_long, native_float16, H5T__conv_long__Float16);
+#endif
/* From unsigned long to floats */
status |=
@@ -1269,6 +1406,10 @@ H5T_init(void)
H5T__register_int(H5T_PERS_HARD, "ulong_dbl", native_ulong, native_double, H5T__conv_ulong_double);
status |=
H5T__register_int(H5T_PERS_HARD, "ulong_ldbl", native_ulong, native_ldouble, H5T__conv_ulong_ldouble);
+#ifdef H5_HAVE__FLOAT16
+ status |= H5T__register_int(H5T_PERS_HARD, "ulong_flt16", native_ulong, native_float16,
+ H5T__conv_ulong__Float16);
+#endif
/* From long long to floats */
status |=
@@ -1279,6 +1420,10 @@ H5T_init(void)
status |=
H5T__register_int(H5T_PERS_HARD, "llong_ldbl", native_llong, native_ldouble, H5T__conv_llong_ldouble);
#endif /* H5T_CONV_INTERNAL_LLONG_LDOUBLE */
+#ifdef H5_HAVE__FLOAT16
+ status |= H5T__register_int(H5T_PERS_HARD, "llong_flt16", native_llong, native_float16,
+ H5T__conv_llong__Float16);
+#endif
/* From unsigned long long to floats */
status |=
@@ -1289,6 +1434,10 @@ H5T_init(void)
status |= H5T__register_int(H5T_PERS_HARD, "ullong_ldbl", native_ullong, native_ldouble,
H5T__conv_ullong_ldouble);
#endif /* H5T_CONV_INTERNAL_ULLONG_LDOUBLE */
+#ifdef H5_HAVE__FLOAT16
+ status |= H5T__register_int(H5T_PERS_HARD, "ullong_flt16", native_ullong, native_float16,
+ H5T__conv_ullong__Float16);
+#endif
/* From floats to char */
status |=
@@ -1297,6 +1446,10 @@ H5T_init(void)
H5T__register_int(H5T_PERS_HARD, "dbl_schar", native_double, native_schar, H5T__conv_double_schar);
status |=
H5T__register_int(H5T_PERS_HARD, "ldbl_schar", native_ldouble, native_schar, H5T__conv_ldouble_schar);
+#ifdef H5_HAVE__FLOAT16
+ status |= H5T__register_int(H5T_PERS_HARD, "flt16_schar", native_float16, native_schar,
+ H5T__conv__Float16_schar);
+#endif
/* From floats to unsigned char */
status |=
@@ -1305,6 +1458,10 @@ H5T_init(void)
H5T__register_int(H5T_PERS_HARD, "dbl_uchar", native_double, native_uchar, H5T__conv_double_uchar);
status |=
H5T__register_int(H5T_PERS_HARD, "ldbl_uchar", native_ldouble, native_uchar, H5T__conv_ldouble_uchar);
+#ifdef H5_HAVE__FLOAT16
+ status |= H5T__register_int(H5T_PERS_HARD, "flt16_uchar", native_float16, native_uchar,
+ H5T__conv__Float16_uchar);
+#endif
/* From floats to short */
status |=
@@ -1313,6 +1470,10 @@ H5T_init(void)
H5T__register_int(H5T_PERS_HARD, "dbl_short", native_double, native_short, H5T__conv_double_short);
status |=
H5T__register_int(H5T_PERS_HARD, "ldbl_short", native_ldouble, native_short, H5T__conv_ldouble_short);
+#ifdef H5_HAVE__FLOAT16
+ status |= H5T__register_int(H5T_PERS_HARD, "flt16_short", native_float16, native_short,
+ H5T__conv__Float16_short);
+#endif
/* From floats to unsigned short */
status |=
@@ -1321,23 +1482,39 @@ H5T_init(void)
H5T__register_int(H5T_PERS_HARD, "dbl_ushort", native_double, native_ushort, H5T__conv_double_ushort);
status |= H5T__register_int(H5T_PERS_HARD, "ldbl_ushort", native_ldouble, native_ushort,
H5T__conv_ldouble_ushort);
+#ifdef H5_HAVE__FLOAT16
+ status |= H5T__register_int(H5T_PERS_HARD, "flt16_ushort", native_float16, native_ushort,
+ H5T__conv__Float16_ushort);
+#endif
/* From floats to int */
status |= H5T__register_int(H5T_PERS_HARD, "flt_int", native_float, native_int, H5T__conv_float_int);
status |= H5T__register_int(H5T_PERS_HARD, "dbl_int", native_double, native_int, H5T__conv_double_int);
status |= H5T__register_int(H5T_PERS_HARD, "ldbl_int", native_ldouble, native_int, H5T__conv_ldouble_int);
+#ifdef H5_HAVE__FLOAT16
+ status |=
+ H5T__register_int(H5T_PERS_HARD, "flt16_int", native_float16, native_int, H5T__conv__Float16_int);
+#endif
/* From floats to unsigned int */
status |= H5T__register_int(H5T_PERS_HARD, "flt_uint", native_float, native_uint, H5T__conv_float_uint);
status |= H5T__register_int(H5T_PERS_HARD, "dbl_uint", native_double, native_uint, H5T__conv_double_uint);
status |=
H5T__register_int(H5T_PERS_HARD, "ldbl_uint", native_ldouble, native_uint, H5T__conv_ldouble_uint);
+#ifdef H5_HAVE__FLOAT16
+ status |=
+ H5T__register_int(H5T_PERS_HARD, "flt16_uint", native_float16, native_uint, H5T__conv__Float16_uint);
+#endif
/* From floats to long */
status |= H5T__register_int(H5T_PERS_HARD, "flt_long", native_float, native_long, H5T__conv_float_long);
status |= H5T__register_int(H5T_PERS_HARD, "dbl_long", native_double, native_long, H5T__conv_double_long);
status |=
H5T__register_int(H5T_PERS_HARD, "ldbl_long", native_ldouble, native_long, H5T__conv_ldouble_long);
+#ifdef H5_HAVE__FLOAT16
+ status |=
+ H5T__register_int(H5T_PERS_HARD, "flt16_long", native_float16, native_long, H5T__conv__Float16_long);
+#endif
/* From floats to unsigned long */
status |=
@@ -1346,6 +1523,10 @@ H5T_init(void)
H5T__register_int(H5T_PERS_HARD, "dbl_ulong", native_double, native_ulong, H5T__conv_double_ulong);
status |=
H5T__register_int(H5T_PERS_HARD, "ldbl_ulong", native_ldouble, native_ulong, H5T__conv_ldouble_ulong);
+#ifdef H5_HAVE__FLOAT16
+ status |= H5T__register_int(H5T_PERS_HARD, "flt16_ulong", native_float16, native_ulong,
+ H5T__conv__Float16_ulong);
+#endif
/* From floats to long long */
status |=
@@ -1356,6 +1537,10 @@ H5T_init(void)
status |=
H5T__register_int(H5T_PERS_HARD, "ldbl_llong", native_ldouble, native_llong, H5T__conv_ldouble_llong);
#endif /* H5T_CONV_INTERNAL_LDOUBLE_LLONG */
+#ifdef H5_HAVE__FLOAT16
+ status |= H5T__register_int(H5T_PERS_HARD, "flt16_llong", native_float16, native_llong,
+ H5T__conv__Float16_llong);
+#endif
/* From floats to unsigned long long */
status |=
@@ -1366,6 +1551,10 @@ H5T_init(void)
status |= H5T__register_int(H5T_PERS_HARD, "ldbl_ullong", native_ldouble, native_ullong,
H5T__conv_ldouble_ullong);
#endif /* H5T_CONV_INTERNAL_LDOUBLE_ULLONG */
+#ifdef H5_HAVE__FLOAT16
+ status |= H5T__register_int(H5T_PERS_HARD, "flt16_ullong", native_float16, native_ullong,
+ H5T__conv__Float16_ullong);
+#endif
/*
* The special no-op conversion is the fastest, so we list it last. The
@@ -1546,99 +1735,102 @@ H5T_top_term_package(void)
/* Reset all the datatype IDs */
if (H5T_IEEE_F32BE_g > 0) {
- H5T_IEEE_F32BE_g = FAIL;
- H5T_IEEE_F32LE_g = FAIL;
- H5T_IEEE_F64BE_g = FAIL;
- H5T_IEEE_F64LE_g = FAIL;
-
- H5T_STD_I8BE_g = FAIL;
- H5T_STD_I8LE_g = FAIL;
- H5T_STD_I16BE_g = FAIL;
- H5T_STD_I16LE_g = FAIL;
- H5T_STD_I32BE_g = FAIL;
- H5T_STD_I32LE_g = FAIL;
- H5T_STD_I64BE_g = FAIL;
- H5T_STD_I64LE_g = FAIL;
- H5T_STD_U8BE_g = FAIL;
- H5T_STD_U8LE_g = FAIL;
- H5T_STD_U16BE_g = FAIL;
- H5T_STD_U16LE_g = FAIL;
- H5T_STD_U32BE_g = FAIL;
- H5T_STD_U32LE_g = FAIL;
- H5T_STD_U64BE_g = FAIL;
- H5T_STD_U64LE_g = FAIL;
- H5T_STD_B8BE_g = FAIL;
- H5T_STD_B8LE_g = FAIL;
- H5T_STD_B16BE_g = FAIL;
- H5T_STD_B16LE_g = FAIL;
- H5T_STD_B32BE_g = FAIL;
- H5T_STD_B32LE_g = FAIL;
- H5T_STD_B64BE_g = FAIL;
- H5T_STD_B64LE_g = FAIL;
- H5T_STD_REF_OBJ_g = FAIL;
- H5T_STD_REF_DSETREG_g = FAIL;
- H5T_STD_REF_g = FAIL;
-
- H5T_UNIX_D32BE_g = FAIL;
- H5T_UNIX_D32LE_g = FAIL;
- H5T_UNIX_D64BE_g = FAIL;
- H5T_UNIX_D64LE_g = FAIL;
-
- H5T_C_S1_g = FAIL;
-
- H5T_FORTRAN_S1_g = FAIL;
-
- H5T_NATIVE_SCHAR_g = FAIL;
- H5T_NATIVE_UCHAR_g = FAIL;
- H5T_NATIVE_SHORT_g = FAIL;
- H5T_NATIVE_USHORT_g = FAIL;
- H5T_NATIVE_INT_g = FAIL;
- H5T_NATIVE_UINT_g = FAIL;
- H5T_NATIVE_LONG_g = FAIL;
- H5T_NATIVE_ULONG_g = FAIL;
- H5T_NATIVE_LLONG_g = FAIL;
- H5T_NATIVE_ULLONG_g = FAIL;
- H5T_NATIVE_FLOAT_g = FAIL;
- H5T_NATIVE_DOUBLE_g = FAIL;
- H5T_NATIVE_LDOUBLE_g = FAIL;
- H5T_NATIVE_B8_g = FAIL;
- H5T_NATIVE_B16_g = FAIL;
- H5T_NATIVE_B32_g = FAIL;
- H5T_NATIVE_B64_g = FAIL;
- H5T_NATIVE_OPAQUE_g = FAIL;
- H5T_NATIVE_HADDR_g = FAIL;
- H5T_NATIVE_HSIZE_g = FAIL;
- H5T_NATIVE_HSSIZE_g = FAIL;
- H5T_NATIVE_HERR_g = FAIL;
- H5T_NATIVE_HBOOL_g = FAIL;
-
- H5T_NATIVE_INT8_g = FAIL;
- H5T_NATIVE_UINT8_g = FAIL;
- H5T_NATIVE_INT_LEAST8_g = FAIL;
- H5T_NATIVE_UINT_LEAST8_g = FAIL;
- H5T_NATIVE_INT_FAST8_g = FAIL;
- H5T_NATIVE_UINT_FAST8_g = FAIL;
-
- H5T_NATIVE_INT16_g = FAIL;
- H5T_NATIVE_UINT16_g = FAIL;
- H5T_NATIVE_INT_LEAST16_g = FAIL;
- H5T_NATIVE_UINT_LEAST16_g = FAIL;
- H5T_NATIVE_INT_FAST16_g = FAIL;
- H5T_NATIVE_UINT_FAST16_g = FAIL;
-
- H5T_NATIVE_INT32_g = FAIL;
- H5T_NATIVE_UINT32_g = FAIL;
- H5T_NATIVE_INT_LEAST32_g = FAIL;
- H5T_NATIVE_UINT_LEAST32_g = FAIL;
- H5T_NATIVE_INT_FAST32_g = FAIL;
- H5T_NATIVE_UINT_FAST32_g = FAIL;
-
- H5T_NATIVE_INT64_g = FAIL;
- H5T_NATIVE_UINT64_g = FAIL;
- H5T_NATIVE_INT_LEAST64_g = FAIL;
- H5T_NATIVE_UINT_LEAST64_g = FAIL;
- H5T_NATIVE_INT_FAST64_g = FAIL;
- H5T_NATIVE_UINT_FAST64_g = FAIL;
+ H5T_IEEE_F16BE_g = H5I_INVALID_HID;
+ H5T_IEEE_F16LE_g = H5I_INVALID_HID;
+ H5T_IEEE_F32BE_g = H5I_INVALID_HID;
+ H5T_IEEE_F32LE_g = H5I_INVALID_HID;
+ H5T_IEEE_F64BE_g = H5I_INVALID_HID;
+ H5T_IEEE_F64LE_g = H5I_INVALID_HID;
+
+ H5T_STD_I8BE_g = H5I_INVALID_HID;
+ H5T_STD_I8LE_g = H5I_INVALID_HID;
+ H5T_STD_I16BE_g = H5I_INVALID_HID;
+ H5T_STD_I16LE_g = H5I_INVALID_HID;
+ H5T_STD_I32BE_g = H5I_INVALID_HID;
+ H5T_STD_I32LE_g = H5I_INVALID_HID;
+ H5T_STD_I64BE_g = H5I_INVALID_HID;
+ H5T_STD_I64LE_g = H5I_INVALID_HID;
+ H5T_STD_U8BE_g = H5I_INVALID_HID;
+ H5T_STD_U8LE_g = H5I_INVALID_HID;
+ H5T_STD_U16BE_g = H5I_INVALID_HID;
+ H5T_STD_U16LE_g = H5I_INVALID_HID;
+ H5T_STD_U32BE_g = H5I_INVALID_HID;
+ H5T_STD_U32LE_g = H5I_INVALID_HID;
+ H5T_STD_U64BE_g = H5I_INVALID_HID;
+ H5T_STD_U64LE_g = H5I_INVALID_HID;
+ H5T_STD_B8BE_g = H5I_INVALID_HID;
+ H5T_STD_B8LE_g = H5I_INVALID_HID;
+ H5T_STD_B16BE_g = H5I_INVALID_HID;
+ H5T_STD_B16LE_g = H5I_INVALID_HID;
+ H5T_STD_B32BE_g = H5I_INVALID_HID;
+ H5T_STD_B32LE_g = H5I_INVALID_HID;
+ H5T_STD_B64BE_g = H5I_INVALID_HID;
+ H5T_STD_B64LE_g = H5I_INVALID_HID;
+ H5T_STD_REF_OBJ_g = H5I_INVALID_HID;
+ H5T_STD_REF_DSETREG_g = H5I_INVALID_HID;
+ H5T_STD_REF_g = H5I_INVALID_HID;
+
+ H5T_UNIX_D32BE_g = H5I_INVALID_HID;
+ H5T_UNIX_D32LE_g = H5I_INVALID_HID;
+ H5T_UNIX_D64BE_g = H5I_INVALID_HID;
+ H5T_UNIX_D64LE_g = H5I_INVALID_HID;
+
+ H5T_C_S1_g = H5I_INVALID_HID;
+
+ H5T_FORTRAN_S1_g = H5I_INVALID_HID;
+
+ H5T_NATIVE_SCHAR_g = H5I_INVALID_HID;
+ H5T_NATIVE_UCHAR_g = H5I_INVALID_HID;
+ H5T_NATIVE_SHORT_g = H5I_INVALID_HID;
+ H5T_NATIVE_USHORT_g = H5I_INVALID_HID;
+ H5T_NATIVE_INT_g = H5I_INVALID_HID;
+ H5T_NATIVE_UINT_g = H5I_INVALID_HID;
+ H5T_NATIVE_LONG_g = H5I_INVALID_HID;
+ H5T_NATIVE_ULONG_g = H5I_INVALID_HID;
+ H5T_NATIVE_LLONG_g = H5I_INVALID_HID;
+ H5T_NATIVE_ULLONG_g = H5I_INVALID_HID;
+ H5T_NATIVE_FLOAT16_g = H5I_INVALID_HID;
+ H5T_NATIVE_FLOAT_g = H5I_INVALID_HID;
+ H5T_NATIVE_DOUBLE_g = H5I_INVALID_HID;
+ H5T_NATIVE_LDOUBLE_g = H5I_INVALID_HID;
+ H5T_NATIVE_B8_g = H5I_INVALID_HID;
+ H5T_NATIVE_B16_g = H5I_INVALID_HID;
+ H5T_NATIVE_B32_g = H5I_INVALID_HID;
+ H5T_NATIVE_B64_g = H5I_INVALID_HID;
+ H5T_NATIVE_OPAQUE_g = H5I_INVALID_HID;
+ H5T_NATIVE_HADDR_g = H5I_INVALID_HID;
+ H5T_NATIVE_HSIZE_g = H5I_INVALID_HID;
+ H5T_NATIVE_HSSIZE_g = H5I_INVALID_HID;
+ H5T_NATIVE_HERR_g = H5I_INVALID_HID;
+ H5T_NATIVE_HBOOL_g = H5I_INVALID_HID;
+
+ H5T_NATIVE_INT8_g = H5I_INVALID_HID;
+ H5T_NATIVE_UINT8_g = H5I_INVALID_HID;
+ H5T_NATIVE_INT_LEAST8_g = H5I_INVALID_HID;
+ H5T_NATIVE_UINT_LEAST8_g = H5I_INVALID_HID;
+ H5T_NATIVE_INT_FAST8_g = H5I_INVALID_HID;
+ H5T_NATIVE_UINT_FAST8_g = H5I_INVALID_HID;
+
+ H5T_NATIVE_INT16_g = H5I_INVALID_HID;
+ H5T_NATIVE_UINT16_g = H5I_INVALID_HID;
+ H5T_NATIVE_INT_LEAST16_g = H5I_INVALID_HID;
+ H5T_NATIVE_UINT_LEAST16_g = H5I_INVALID_HID;
+ H5T_NATIVE_INT_FAST16_g = H5I_INVALID_HID;
+ H5T_NATIVE_UINT_FAST16_g = H5I_INVALID_HID;
+
+ H5T_NATIVE_INT32_g = H5I_INVALID_HID;
+ H5T_NATIVE_UINT32_g = H5I_INVALID_HID;
+ H5T_NATIVE_INT_LEAST32_g = H5I_INVALID_HID;
+ H5T_NATIVE_UINT_LEAST32_g = H5I_INVALID_HID;
+ H5T_NATIVE_INT_FAST32_g = H5I_INVALID_HID;
+ H5T_NATIVE_UINT_FAST32_g = H5I_INVALID_HID;
+
+ H5T_NATIVE_INT64_g = H5I_INVALID_HID;
+ H5T_NATIVE_UINT64_g = H5I_INVALID_HID;
+ H5T_NATIVE_INT_LEAST64_g = H5I_INVALID_HID;
+ H5T_NATIVE_UINT_LEAST64_g = H5I_INVALID_HID;
+ H5T_NATIVE_INT_FAST64_g = H5I_INVALID_HID;
+ H5T_NATIVE_UINT_FAST64_g = H5I_INVALID_HID;
n++;
} /* end if */
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index a37800b..0e35fb5 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -112,6 +112,14 @@
* at least as wide as the destination. Overflow can occur
* when the source magnitude is too large for the destination.
*
+ * fX: Floating-point values to integers where the destination is at least
+ * as wide as the source. This case cannot generate overflows.
+ *
+ * Xf: Integers to floating-point values where the source is at least as
+ * wide 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
@@ -704,6 +712,99 @@
H5T_CONV(H5T_CONV_Fx, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, Y) \
} while (0)
+#define H5T_CONV_fX(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
+ do { \
+ HDcompile_assert(sizeof(ST) <= sizeof(DT)); \
+ H5T_CONV(H5T_CONV_xX, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \
+ } while (0)
+
+#define H5T_CONV_Xf_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
+ { \
+ if (*(S) > (ST)(D_MAX) || (sprec < dprec && *(S) == (ST)(D_MAX))) { \
+ H5T_conv_ret_t except_ret = (conv_ctx->u.conv.cb_struct.func)( \
+ H5T_CONV_EXCEPT_RANGE_HI, conv_ctx->u.conv.src_type_id, conv_ctx->u.conv.dst_type_id, S, D, \
+ conv_ctx->u.conv.cb_struct.user_data); \
+ if (except_ret == H5T_CONV_UNHANDLED) \
+ /* Let compiler convert if case is ignored by user handler*/ \
+ *(D) = H5_GLUE3(H5T_NATIVE_, DTYPE, _POS_INF_g); \
+ else if (except_ret == H5T_CONV_ABORT) \
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \
+ /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
+ } \
+ else if (*(S) < (ST)(D_MIN)) { \
+ H5T_conv_ret_t except_ret = (conv_ctx->u.conv.cb_struct.func)( \
+ H5T_CONV_EXCEPT_RANGE_LOW, conv_ctx->u.conv.src_type_id, conv_ctx->u.conv.dst_type_id, S, D, \
+ conv_ctx->u.conv.cb_struct.user_data); \
+ if (except_ret == H5T_CONV_UNHANDLED) \
+ /* Let compiler convert if case is ignored by user handler*/ \
+ *(D) = H5_GLUE3(H5T_NATIVE_, DTYPE, _NEG_INF_g); \
+ else if (except_ret == H5T_CONV_ABORT) \
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \
+ /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
+ } \
+ else if (sprec > dprec) { \
+ unsigned low_bit_pos, high_bit_pos; \
+ \
+ /* Detect high & low bits set in source */ \
+ H5T_HI_LO_BIT_SET(ST, *(S), low_bit_pos, high_bit_pos) \
+ \
+ /* Check for more bits of precision in src than available in dst */ \
+ if ((high_bit_pos - low_bit_pos) >= dprec) { \
+ H5T_conv_ret_t except_ret = (conv_ctx->u.conv.cb_struct.func)( \
+ H5T_CONV_EXCEPT_PRECISION, conv_ctx->u.conv.src_type_id, conv_ctx->u.conv.dst_type_id, \
+ S, D, conv_ctx->u.conv.cb_struct.user_data); \
+ if (except_ret == H5T_CONV_UNHANDLED) \
+ /* Let compiler convert if case is ignored by user handler*/ \
+ *(D) = (DT)(*(S)); \
+ else if (except_ret == H5T_CONV_ABORT) \
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \
+ /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
+ } \
+ else \
+ *(D) = (DT)(*(S)); \
+ } \
+ else \
+ *(D) = (DT)(*(S)); \
+ }
+#define H5T_CONV_Xf_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
+ { \
+ if (*(S) > (ST)(D_MAX)) \
+ *(D) = H5_GLUE3(H5T_NATIVE_, DTYPE, _POS_INF_g); \
+ else { \
+ intmax_t s_cast = (intmax_t)(*(S)); \
+ intmax_t d_cast = (intmax_t)(D_MAX); \
+ \
+ /* Check if source value would underflow destination. Do NOT do this \
+ * by comparing against D_MIN casted to type ST here, as this will \
+ * generally be undefined behavior (casting negative float value <= 1.0 \
+ * to integer) for all floating point types and some compilers optimize \
+ * this in a way that causes unexpected behavior. Instead, grab the \
+ * absolute value of the source value first, then compare it to D_MAX. \
+ */ \
+ if (s_cast != INTMAX_MIN) \
+ s_cast = imaxabs(s_cast); \
+ else { \
+ /* Handle two's complement integer representations where abs(INTMAX_MIN) \
+ * can't be represented. Other representations will fall here as well, \
+ * but this should be fine. \
+ */ \
+ s_cast = INTMAX_MAX; \
+ d_cast -= 1; \
+ } \
+ \
+ if (s_cast > d_cast) \
+ *(D) = H5_GLUE3(H5T_NATIVE_, DTYPE, _NEG_INF_g); \
+ else \
+ *(D) = (DT)(*(S)); \
+ } \
+ }
+
+#define H5T_CONV_Xf(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
+ do { \
+ HDcompile_assert(sizeof(ST) >= sizeof(DT)); \
+ H5T_CONV(H5T_CONV_Xf, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, Y) \
+ } while (0)
+
/* Since all "no exception" cores do the same thing (assign the value in the
* source location to the destination location, using casting), use one "core"
* to do them all.
@@ -8215,6 +8316,255 @@ H5T__conv_ldouble_ullong(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_con
}
#endif /*H5T_CONV_INTERNAL_LDOUBLE_ULLONG*/
+/* Conversions for _Float16 type */
+#ifdef H5_HAVE__FLOAT16
+herr_t
+H5T__conv_schar__Float16(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
+ size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf,
+ void H5_ATTR_UNUSED *bkg)
+{
+ H5T_CONV_xF(SCHAR, FLOAT16, signed char, H5__Float16, -, -);
+}
+
+herr_t
+H5T__conv_uchar__Float16(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
+ size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf,
+ void H5_ATTR_UNUSED *bkg)
+{
+ H5T_CONV_xF(UCHAR, FLOAT16, unsigned char, H5__Float16, -, -);
+}
+
+herr_t
+H5T__conv_short__Float16(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
+ size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf,
+ void H5_ATTR_UNUSED *bkg)
+{
+ H5T_CONV_xF(SHORT, FLOAT16, short, H5__Float16, -, -);
+}
+
+herr_t
+H5T__conv_ushort__Float16(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
+ size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf,
+ void H5_ATTR_UNUSED *bkg)
+{
+ /* Suppress warning about non-standard floating-point literal suffix */
+ H5_GCC_CLANG_DIAG_OFF("pedantic")
+ H5T_CONV_Xf(USHORT, FLOAT16, unsigned short, H5__Float16, -FLT16_MAX, FLT16_MAX);
+ H5_GCC_CLANG_DIAG_ON("pedantic")
+}
+
+herr_t
+H5T__conv_int__Float16(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
+ size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf,
+ void H5_ATTR_UNUSED *bkg)
+{
+ /* Suppress warning about non-standard floating-point literal suffix */
+ H5_GCC_CLANG_DIAG_OFF("pedantic")
+ H5T_CONV_Xf(INT, FLOAT16, int, H5__Float16, -FLT16_MAX, FLT16_MAX);
+ H5_GCC_CLANG_DIAG_ON("pedantic")
+}
+
+herr_t
+H5T__conv_uint__Float16(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
+ size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf,
+ void H5_ATTR_UNUSED *bkg)
+{
+ /* Suppress warning about non-standard floating-point literal suffix */
+ H5_GCC_CLANG_DIAG_OFF("pedantic")
+ H5T_CONV_Xf(UINT, FLOAT16, unsigned int, H5__Float16, -FLT16_MAX, FLT16_MAX);
+ H5_GCC_CLANG_DIAG_ON("pedantic")
+}
+
+herr_t
+H5T__conv_long__Float16(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
+ size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf,
+ void H5_ATTR_UNUSED *bkg)
+{
+ /* Suppress warning about non-standard floating-point literal suffix */
+ H5_GCC_CLANG_DIAG_OFF("pedantic")
+ H5T_CONV_Xf(LONG, FLOAT16, long, H5__Float16, -FLT16_MAX, FLT16_MAX);
+ H5_GCC_CLANG_DIAG_ON("pedantic")
+}
+
+herr_t
+H5T__conv_ulong__Float16(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
+ size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf,
+ void H5_ATTR_UNUSED *bkg)
+{
+ /* Suppress warning about non-standard floating-point literal suffix */
+ H5_GCC_CLANG_DIAG_OFF("pedantic")
+ H5T_CONV_Xf(ULONG, FLOAT16, unsigned long, H5__Float16, -FLT16_MAX, FLT16_MAX);
+ H5_GCC_CLANG_DIAG_ON("pedantic")
+}
+
+herr_t
+H5T__conv_llong__Float16(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
+ size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf,
+ void H5_ATTR_UNUSED *bkg)
+{
+ /* Suppress warning about non-standard floating-point literal suffix */
+ H5_GCC_CLANG_DIAG_OFF("pedantic")
+ H5T_CONV_Xf(LLONG, FLOAT16, long long, H5__Float16, -FLT16_MAX, FLT16_MAX);
+ H5_GCC_CLANG_DIAG_ON("pedantic")
+}
+
+herr_t
+H5T__conv_ullong__Float16(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
+ size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf,
+ void H5_ATTR_UNUSED *bkg)
+{
+ /* Suppress warning about non-standard floating-point literal suffix */
+ H5_GCC_CLANG_DIAG_OFF("pedantic")
+ H5T_CONV_Xf(ULLONG, FLOAT16, unsigned long long, H5__Float16, -FLT16_MAX, FLT16_MAX);
+ H5_GCC_CLANG_DIAG_ON("pedantic")
+}
+
+herr_t
+H5T__conv_float__Float16(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
+ size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf,
+ void H5_ATTR_UNUSED *bkg)
+{
+ /* Suppress warning about non-standard floating-point literal suffix */
+ H5_GCC_CLANG_DIAG_OFF("pedantic")
+ H5T_CONV_Ff(FLOAT, FLOAT16, float, H5__Float16, -FLT16_MAX, FLT16_MAX);
+ H5_GCC_CLANG_DIAG_ON("pedantic")
+}
+
+herr_t
+H5T__conv_double__Float16(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
+ size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf,
+ void H5_ATTR_UNUSED *bkg)
+{
+ /* Suppress warning about non-standard floating-point literal suffix */
+ H5_GCC_CLANG_DIAG_OFF("pedantic")
+ H5T_CONV_Ff(DOUBLE, FLOAT16, double, H5__Float16, -FLT16_MAX, FLT16_MAX);
+ H5_GCC_CLANG_DIAG_ON("pedantic")
+}
+
+#ifdef H5T_CONV_INTERNAL_LDOUBLE_FLOAT16
+herr_t
+H5T__conv_ldouble__Float16(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
+ size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf,
+ void H5_ATTR_UNUSED *bkg)
+{
+ /* Suppress warning about non-standard floating-point literal suffix */
+ H5_GCC_CLANG_DIAG_OFF("pedantic")
+ H5T_CONV_Ff(LDOUBLE, FLOAT16, long double, H5__Float16, -FLT16_MAX, FLT16_MAX);
+ H5_GCC_CLANG_DIAG_ON("pedantic")
+}
+#endif
+
+herr_t
+H5T__conv__Float16_schar(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
+ size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf,
+ void H5_ATTR_UNUSED *bkg)
+{
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
+ H5T_CONV_Fx(FLOAT16, SCHAR, H5__Float16, signed char, SCHAR_MIN, SCHAR_MAX);
+ H5_GCC_CLANG_DIAG_ON("float-equal")
+}
+
+herr_t
+H5T__conv__Float16_uchar(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
+ size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf,
+ void H5_ATTR_UNUSED *bkg)
+{
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
+ H5T_CONV_Fx(FLOAT16, UCHAR, H5__Float16, unsigned char, 0, UCHAR_MAX);
+ H5_GCC_CLANG_DIAG_ON("float-equal")
+}
+
+herr_t
+H5T__conv__Float16_short(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
+ size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf,
+ void H5_ATTR_UNUSED *bkg)
+{
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
+ H5T_CONV_Fx(FLOAT16, SHORT, H5__Float16, short, SHRT_MIN, SHRT_MAX);
+ H5_GCC_CLANG_DIAG_ON("float-equal")
+}
+
+herr_t
+H5T__conv__Float16_ushort(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
+ size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf,
+ void H5_ATTR_UNUSED *bkg)
+{
+ H5T_CONV_fX(FLOAT16, USHORT, H5__Float16, unsigned short, 0, USHRT_MAX);
+}
+
+herr_t
+H5T__conv__Float16_int(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
+ size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf,
+ void H5_ATTR_UNUSED *bkg)
+{
+ H5T_CONV_fX(FLOAT16, INT, H5__Float16, int, INT_MIN, INT_MAX);
+}
+
+herr_t
+H5T__conv__Float16_uint(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
+ size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf,
+ void H5_ATTR_UNUSED *bkg)
+{
+ H5T_CONV_fX(FLOAT16, UINT, H5__Float16, unsigned int, 0, UINT_MAX);
+}
+
+herr_t
+H5T__conv__Float16_long(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
+ size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf,
+ void H5_ATTR_UNUSED *bkg)
+{
+ H5T_CONV_fX(FLOAT16, LONG, H5__Float16, long, LONG_MIN, LONG_MAX);
+}
+
+herr_t
+H5T__conv__Float16_ulong(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
+ size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf,
+ void H5_ATTR_UNUSED *bkg)
+{
+ H5T_CONV_fX(FLOAT16, ULONG, H5__Float16, unsigned long, 0, ULONG_MAX);
+}
+
+herr_t
+H5T__conv__Float16_llong(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
+ size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf,
+ void H5_ATTR_UNUSED *bkg)
+{
+ H5T_CONV_fX(FLOAT16, LLONG, H5__Float16, long long, LLONG_MIN, LLONG_MAX);
+}
+
+herr_t
+H5T__conv__Float16_ullong(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
+ size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf,
+ void H5_ATTR_UNUSED *bkg)
+{
+ H5T_CONV_fX(FLOAT16, ULLONG, H5__Float16, unsigned long long, 0, ULLONG_MAX);
+}
+
+herr_t
+H5T__conv__Float16_float(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
+ size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf,
+ void H5_ATTR_UNUSED *bkg)
+{
+ H5T_CONV_fF(FLOAT16, FLOAT, H5__Float16, float, -, -);
+}
+
+herr_t
+H5T__conv__Float16_double(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
+ size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf,
+ void H5_ATTR_UNUSED *bkg)
+{
+ H5T_CONV_fF(FLOAT16, DOUBLE, H5__Float16, double, -, -);
+}
+
+herr_t
+H5T__conv__Float16_ldouble(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
+ size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf,
+ void H5_ATTR_UNUSED *bkg)
+{
+ H5T_CONV_fF(FLOAT16, LDOUBLE, H5__Float16, long double, -, -);
+}
+#endif
+
/*-------------------------------------------------------------------------
* Function: H5T__conv_f_i
*
@@ -8249,8 +8599,9 @@ H5T__conv_f_i(H5T_t *src_p, H5T_t *dst_p, H5T_cdata_t *cdata, const H5T_conv_ctx
uint8_t *int_buf = NULL; /*buffer for temporary value */
size_t buf_size; /*buffer size for temporary value */
size_t i; /*miscellaneous counters */
- size_t first; /*first bit(MSB) in an integer */
- ssize_t sfirst; /*a signed version of `first' */
+ ssize_t msb_pos_s; /*first bit(MSB) in an integer */
+ ssize_t new_msb_pos; /*MSB position after shifting mantissa by exponent */
+ hssize_t shift_val; /*shift value when shifting mantissa by exponent */
bool truncated; /*if fraction value is dropped */
bool reverse; /*if reverse order of destination at the end */
H5T_conv_ret_t except_ret; /*return of callback function */
@@ -8314,8 +8665,11 @@ H5T__conv_f_i(H5T_t *src_p, H5T_t *dst_p, H5T_cdata_t *cdata, const H5T_conv_ctx
/* Allocate enough space for the buffer holding temporary
* converted value
*/
- buf_size = (size_t)(pow(2.0, (double)src.u.f.esize) / 8 + 1);
- int_buf = (uint8_t *)H5MM_calloc(buf_size);
+ if (dst.prec / 8 > src_p->shared->size)
+ buf_size = (dst.prec + 7) / 8;
+ else
+ buf_size = src_p->shared->size;
+ int_buf = (uint8_t *)H5MM_calloc(buf_size);
/* Allocate space for order-reversed source buffer */
src_rev = (uint8_t *)H5MM_calloc(src_p->shared->size);
@@ -8581,35 +8935,46 @@ H5T__conv_f_i(H5T_t *src_p, H5T_t *dst_p, H5T_cdata_t *cdata, const H5T_conv_ctx
H5T__bit_inc(int_buf, src.u.f.msize, 8 * buf_size - src.u.f.msize);
/*
+ * What is the bit position for the most significant bit(MSB) of S
+ * which is set? This is checked before shifting and before possibly
+ * converting to a negative integer. Note that later use of this value
+ * assumes that H5T__bit_shift will always shift in 0 during a right
+ * shift.
+ */
+ msb_pos_s = H5T__bit_find(int_buf, (size_t)0, src.prec, H5T_BIT_MSB, true);
+
+ /*
+ * The temporary buffer has no bits set and must therefore be
+ * zero; nothing to do.
+ */
+ if (msb_pos_s < 0)
+ goto padding;
+
+ /*
* Shift mantissa part by exponent minus mantissa size(right shift),
* or by mantissa size minus exponent(left shift). Example: Sequence
* 10...010111, expo=20, expo-msize=-3. Right-shift the sequence, we get
* 00010...10. The last three bits were dropped.
*/
- H5T__bit_shift(int_buf, expo - (ssize_t)src.u.f.msize, (size_t)0, buf_size * 8);
+ shift_val = expo - (ssize_t)src.u.f.msize;
+ H5T__bit_shift(int_buf, shift_val, (size_t)0, buf_size * 8);
+
+ /* Calculate the new position of the MSB after shifting and
+ * skip to the padding section if we shifted exactly to 0
+ * (MSB position is -1)
+ */
+ new_msb_pos = msb_pos_s + shift_val;
+ if (new_msb_pos == -1)
+ goto padding;
/*
- * If expo is less than mantissa size, the frantional value is dropped off
+ * If expo is less than mantissa size, the fractional value is dropped off
* during conversion. Set exception type to be "truncate"
*/
if ((size_t)expo < src.u.f.msize && conv_ctx->u.conv.cb_struct.func)
truncated = true;
- /*
- * What is the bit position for the most significant bit(MSB) of S
- * which is set? This is checked before converted to negative
- * integer.
- */
- sfirst = H5T__bit_find(int_buf, (size_t)0, 8 * buf_size, H5T_BIT_MSB, true);
- first = (size_t)sfirst;
-
- if (sfirst < 0) {
- /*
- * The source has no bits set and must therefore be zero.
- * Set the destination to zero - nothing to do.
- */
- }
- else if (H5T_SGN_NONE == dst.u.i.sign) { /*destination is unsigned*/
+ if (H5T_SGN_NONE == dst.u.i.sign) { /*destination is unsigned*/
/*
* Destination is unsigned. Library's default way: If the source value
* is greater than the maximal destination value then it overflows, the
@@ -8639,7 +9004,7 @@ H5T__conv_f_i(H5T_t *src_p, H5T_t *dst_p, H5T_cdata_t *cdata, const H5T_conv_ctx
}
}
else { /*source is positive*/
- if (first >= dst.prec) {
+ if (new_msb_pos >= (ssize_t)dst.prec) {
/*overflow*/
if (conv_ctx->u.conv.cb_struct
.func) { /*If user's exception handler is present, use it*/
@@ -8663,7 +9028,7 @@ H5T__conv_f_i(H5T_t *src_p, H5T_t *dst_p, H5T_cdata_t *cdata, const H5T_conv_ctx
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL,
"can't handle conversion exception");
}
- else if (first < dst.prec) {
+ else {
if (truncated && conv_ctx->u.conv.cb_struct
.func) { /*If user's exception handler is present, use it*/
/*reverse order first*/
@@ -8675,9 +9040,11 @@ H5T__conv_f_i(H5T_t *src_p, H5T_t *dst_p, H5T_cdata_t *cdata, const H5T_conv_ctx
conv_ctx->u.conv.cb_struct.user_data);
}
- if (except_ret == H5T_CONV_UNHANDLED)
+ if (except_ret == H5T_CONV_UNHANDLED) {
/*copy source value into it if case is ignored by user handler*/
- H5T__bit_copy(d, dst.offset, int_buf, (size_t)0, first + 1);
+ if (new_msb_pos >= 0)
+ H5T__bit_copy(d, dst.offset, int_buf, (size_t)0, (size_t)new_msb_pos + 1);
+ }
else if (except_ret == H5T_CONV_HANDLED) {
/*No need to reverse the order of destination because user handles it*/
reverse = false;
@@ -8691,7 +9058,7 @@ H5T__conv_f_i(H5T_t *src_p, H5T_t *dst_p, H5T_cdata_t *cdata, const H5T_conv_ctx
}
else if (H5T_SGN_2 == dst.u.i.sign) { /*Destination is signed*/
if (sign) { /*source is negative*/
- if (first < dst.prec - 1) {
+ if ((new_msb_pos >= 0) && ((size_t)new_msb_pos < dst.prec - 1)) {
if (truncated && conv_ctx->u.conv.cb_struct
.func) { /*If user's exception handler is present, use it*/
/*reverse order first*/
@@ -8705,8 +9072,8 @@ H5T__conv_f_i(H5T_t *src_p, H5T_t *dst_p, H5T_cdata_t *cdata, const H5T_conv_ctx
if (except_ret == H5T_CONV_UNHANDLED) { /*If this case ignored by user handler*/
/*Convert to integer representation. Equivalent to ~(value - 1).*/
- H5T__bit_dec(int_buf, (size_t)0, 8 * buf_size);
- H5T__bit_neg(int_buf, (size_t)0, 8 * buf_size);
+ H5T__bit_dec(int_buf, (size_t)0, dst.prec);
+ H5T__bit_neg(int_buf, (size_t)0, dst.prec);
/*copy source value into destination*/
H5T__bit_copy(d, dst.offset, int_buf, (size_t)0, dst.prec - 1);
@@ -8749,7 +9116,7 @@ H5T__conv_f_i(H5T_t *src_p, H5T_t *dst_p, H5T_cdata_t *cdata, const H5T_conv_ctx
}
}
else { /*source is positive*/
- if (first >= dst.prec - 1) {
+ if (new_msb_pos >= (ssize_t)dst.prec - 1) {
/*overflow*/
if (conv_ctx->u.conv.cb_struct
.func) { /*If user's exception handler is present, use it*/
@@ -8773,7 +9140,7 @@ H5T__conv_f_i(H5T_t *src_p, H5T_t *dst_p, H5T_cdata_t *cdata, const H5T_conv_ctx
goto next;
}
}
- else if (first < dst.prec - 1) {
+ else if (new_msb_pos < (ssize_t)dst.prec - 1) {
if (truncated && conv_ctx->u.conv.cb_struct
.func) { /*If user's exception handler is present, use it*/
/*reverse order first*/
@@ -8787,7 +9154,8 @@ H5T__conv_f_i(H5T_t *src_p, H5T_t *dst_p, H5T_cdata_t *cdata, const H5T_conv_ctx
if (except_ret == H5T_CONV_UNHANDLED) {
/*copy source value into it if case is ignored by user handler*/
- H5T__bit_copy(d, dst.offset, int_buf, (size_t)0, first + 1);
+ if (new_msb_pos >= 0)
+ H5T__bit_copy(d, dst.offset, int_buf, (size_t)0, (size_t)new_msb_pos + 1);
}
else if (except_ret == H5T_CONV_ABORT)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL,
@@ -8963,7 +9331,7 @@ H5T__conv_i_f(H5T_t *src_p, H5T_t *dst_p, H5T_cdata_t *cdata, const H5T_conv_ctx
/* Allocate enough space for the buffer holding temporary
* converted value
*/
- buf_size = (src.prec > dst.u.f.msize ? src.prec : dst.u.f.msize) / 8 + 1;
+ buf_size = ((src.prec > dst.u.f.msize ? src.prec : dst.u.f.msize) + 7) / 8;
int_buf = (uint8_t *)H5MM_calloc(buf_size);
/* Allocate space for order-reversed source buffer */
@@ -9189,7 +9557,8 @@ H5T__conv_i_f(H5T_t *src_p, H5T_t *dst_p, H5T_cdata_t *cdata, const H5T_conv_ctx
goto padding;
}
}
- else {
+
+ if (!conv_ctx->u.conv.cb_struct.func || (except_ret == H5T_CONV_UNHANDLED)) {
/*make destination infinity by setting exponent to maximal number and
*mantissa to zero.*/
expo = expo_max;
diff --git a/src/H5Tinit_float.c b/src/H5Tinit_float.c
index 3213f00..7ddd65b 100644
--- a/src/H5Tinit_float.c
+++ b/src/H5Tinit_float.c
@@ -53,8 +53,8 @@
* Purpose: This macro takes a floating point type like `double' and
* and detects byte order, mantissa location, exponent location,
* sign bit location, presence or absence of implicit mantissa
- * bit, and exponent bias and initializes a detected_t structure
- * with those properties.
+ * bit, and exponent bias and initializes a H5T_fpoint_det_t
+ * structure with those properties.
*
* Note that these operations can raise floating-point
* exceptions and building with some compiler options
@@ -306,14 +306,17 @@ H5T__fix_order(int n, int last, int *perm, H5T_order_t *order)
if (last <= 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "failed to detect byte order");
- /* We have at least three points to consider */
- if (perm[last] < perm[last - 1] && perm[last - 1] < perm[last - 2]) {
+ if (perm[last] < perm[last - 1] &&
+ /* Only check perm[last - 2] if we have more than 2 points to consider */
+ ((last < 2) || (perm[last - 1] < perm[last - 2]))) {
/* Little endian */
*order = H5T_ORDER_LE;
for (int i = 0; i < n; i++)
perm[i] = i;
}
- else if (perm[last] > perm[last - 1] && perm[last - 1] > perm[last - 2]) {
+ else if (perm[last] > perm[last - 1] &&
+ /* Only check perm[last - 2] if we have more than 2 points to consider */
+ ((last < 2) || (perm[last - 1] > perm[last - 2]))) {
/* Big endian */
*order = H5T_ORDER_BE;
for (int i = 0; i < n; i++)
@@ -358,7 +361,7 @@ done:
* Return: imp_bit will be set to 1 if the most significant bit
* of the mantissa is discarded (ie, the mantissa has an
* implicit `one' as the most significant bit). Otherwise,
- * imp_bit will be set to zero zero.
+ * imp_bit will be set to zero.
*
* SUCCEED/FAIL
*-------------------------------------------------------------------------
@@ -570,6 +573,39 @@ H5T__init_native_float_types(void)
*/
H5T_native_order_g = det.order;
+#ifdef H5_HAVE__FLOAT16
+ /* H5T_NATIVE_FLOAT16 */
+
+ /* Get the type's characteristics */
+ memset(&det, 0, sizeof(H5T_fpoint_det_t));
+ DETECT_F(H5__Float16, det);
+
+ /* Allocate and fill type structure */
+ if (NULL == (dt = H5T__alloc()))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed");
+ dt->shared->state = H5T_STATE_IMMUTABLE;
+ dt->shared->type = H5T_FLOAT;
+ dt->shared->size = det.size;
+ dt->shared->u.atomic.order = det.order;
+ dt->shared->u.atomic.offset = det.offset;
+ dt->shared->u.atomic.prec = det.prec;
+ dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;
+ dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;
+ dt->shared->u.atomic.u.f.sign = det.sign;
+ dt->shared->u.atomic.u.f.epos = det.epos;
+ dt->shared->u.atomic.u.f.esize = det.esize;
+ dt->shared->u.atomic.u.f.ebias = det.ebias;
+ dt->shared->u.atomic.u.f.mpos = det.mpos;
+ dt->shared->u.atomic.u.f.msize = det.msize;
+ dt->shared->u.atomic.u.f.norm = det.norm;
+ dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO;
+
+ /* Register the type and set global variables */
+ if ((H5T_NATIVE_FLOAT16_g = H5I_register(H5I_DATATYPE, dt, false)) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype");
+ H5T_NATIVE_FLOAT16_ALIGN_g = det.comp_align;
+#endif
+
done:
/* Clear any FE_INVALID exceptions from NaN handling */
if (feclearexcept(FE_INVALID) != 0)
diff --git a/src/H5Tmodule.h b/src/H5Tmodule.h
index f1b7b17..35e748b 100644
--- a/src/H5Tmodule.h
+++ b/src/H5Tmodule.h
@@ -712,6 +712,14 @@
* </tr>
* <tr>
* <td>
+ * #H5T_NATIVE_FLOAT16
+ * </td>
+ * <td span='3'>
+ * _Float16
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>
* #H5T_NATIVE_FLOAT
* </td>
* <td span='3'>
@@ -3732,8 +3740,8 @@ filled according to the value of this property. The padding can be:
* datatypes.
*
* The currently supported text format used by #H5LTtext_to_dtype and #H5LTdtype_to_text is the
- * data description language (DDL) and conforms to the \ref DDLBNF110. The portion of the
- * \ref DDLBNF110 that defines HDF5 datatypes appears below.
+ * data description language (DDL) and conforms to the \ref DDLBNF114. The portion of the
+ * \ref DDLBNF114 that defines HDF5 datatypes appears below.
* <em>The definition of HDF5 datatypes from the HDF5 DDL</em>
* \code
* <datatype> ::= <atomic_type> | <compound_type> | <variable_length_type> | <array_type>
@@ -3753,10 +3761,11 @@ filled according to the value of this property. The padding can be:
* H5T_NATIVE_INT | H5T_NATIVE_UINT |
* H5T_NATIVE_LONG | H5T_NATIVE_ULONG |
* H5T_NATIVE_LLONG | H5T_NATIVE_ULLONG
- * <float> ::= H5T_IEEE_F32BE | H5T_IEEE_F32LE |
+ * <float> ::= H5T_IEEE_F16BE | H5T_IEEE_F16LE |
+ * H5T_IEEE_F32BE | H5T_IEEE_F32LE |
* H5T_IEEE_F64BE | H5T_IEEE_F64LE |
- * H5T_NATIVE_FLOAT | H5T_NATIVE_DOUBLE |
- * H5T_NATIVE_LDOUBLE
+ * H5T_NATIVE_FLOAT16 | H5T_NATIVE_FLOAT |
+ * H5T_NATIVE_DOUBLE | H5T_NATIVE_LDOUBLE
* <time> ::= H5T_TIME: not yet implemented
* <string> ::= H5T_STRING {
* STRSIZE <strsize> ;
diff --git a/src/H5Tnative.c b/src/H5Tnative.c
index bf039e6..46ffe77 100644
--- a/src/H5Tnative.c
+++ b/src/H5Tnative.c
@@ -48,6 +48,7 @@ static herr_t H5T__cmp_offset(size_t *comp_size, size_t *offset, size_t elem_siz
* H5T_NATIVE_LONG H5T_NATIVE_ULONG
* H5T_NATIVE_LLONG H5T_NATIVE_ULLONG
*
+ * H5T_NATIVE_FLOAT16 (if available)
* H5T_NATIVE_FLOAT
* H5T_NATIVE_DOUBLE
* H5T_NATIVE_LDOUBLE
@@ -693,6 +694,7 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali
size_t align = 0; /* Alignment necessary for native datatype */
size_t native_size = 0; /* Datatype size of the native type */
enum match_type { /* The different kinds of floating point types we can match */
+ H5T_NATIVE_FLOAT_MATCH_FLOAT16,
H5T_NATIVE_FLOAT_MATCH_FLOAT,
H5T_NATIVE_FLOAT_MATCH_DOUBLE,
H5T_NATIVE_FLOAT_MATCH_LDOUBLE,
@@ -705,7 +707,14 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali
assert(size > 0);
if (direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND) {
- if (size <= sizeof(float)) {
+#ifdef H5_HAVE__FLOAT16
+ if (size <= sizeof(H5__Float16)) {
+ match = H5T_NATIVE_FLOAT_MATCH_FLOAT16;
+ native_size = sizeof(H5__Float16);
+ }
+ else
+#endif
+ if (size <= sizeof(float)) {
match = H5T_NATIVE_FLOAT_MATCH_FLOAT;
native_size = sizeof(float);
}
@@ -731,14 +740,29 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali
match = H5T_NATIVE_FLOAT_MATCH_DOUBLE;
native_size = sizeof(double);
}
- else {
+ else
+#ifdef H5_HAVE__FLOAT16
+ if (size > sizeof(H5__Float16))
+#endif
+ {
match = H5T_NATIVE_FLOAT_MATCH_FLOAT;
native_size = sizeof(float);
}
+#ifdef H5_HAVE__FLOAT16
+ else {
+ match = H5T_NATIVE_FLOAT_MATCH_FLOAT16;
+ native_size = sizeof(H5__Float16);
+ }
+#endif
}
/* Set the appropriate native floating point information */
switch (match) {
+ case H5T_NATIVE_FLOAT_MATCH_FLOAT16:
+ tid = H5T_NATIVE_FLOAT16;
+ align = H5T_NATIVE_FLOAT16_ALIGN_g;
+ break;
+
case H5T_NATIVE_FLOAT_MATCH_FLOAT:
tid = H5T_NATIVE_FLOAT;
align = H5T_NATIVE_FLOAT_ALIGN_g;
diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h
index ddca0b3..626c9d5 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -143,6 +143,14 @@
#define H5T_CONV_INTERNAL_LDOUBLE_ULLONG 0
#endif
+/* Define an internal macro for converting long double to _Float16. Mac OS 13
+ * gives incorrect conversions that appear to be resolved in Mac OS 14. */
+#ifdef H5_HAVE__FLOAT16
+#if (H5_WANT_DATA_ACCURACY && defined(H5_LDOUBLE_TO_FLOAT16_CORRECT)) || (!H5_WANT_DATA_ACCURACY)
+#define H5T_CONV_INTERNAL_LDOUBLE_FLOAT16 1
+#endif
+#endif
+
/* Statistics about a conversion function */
struct H5T_stats_t {
unsigned ncalls; /*num calls to conversion function */
@@ -442,6 +450,7 @@ H5_DLLVAR size_t H5T_NATIVE_LONG_ALIGN_g;
H5_DLLVAR size_t H5T_NATIVE_ULONG_ALIGN_g;
H5_DLLVAR size_t H5T_NATIVE_LLONG_ALIGN_g;
H5_DLLVAR size_t H5T_NATIVE_ULLONG_ALIGN_g;
+H5_DLLVAR size_t H5T_NATIVE_FLOAT16_ALIGN_g;
H5_DLLVAR size_t H5T_NATIVE_FLOAT_ALIGN_g;
H5_DLLVAR size_t H5T_NATIVE_DOUBLE_ALIGN_g;
H5_DLLVAR size_t H5T_NATIVE_LDOUBLE_ALIGN_g;
@@ -477,6 +486,10 @@ H5_DLLVAR size_t H5T_NATIVE_UINT_FAST64_ALIGN_g;
/* Useful floating-point values for conversion routines */
/* (+/- Inf for all floating-point types) */
+#ifdef H5_HAVE__FLOAT16
+H5_DLLVAR H5__Float16 H5T_NATIVE_FLOAT16_POS_INF_g;
+H5_DLLVAR H5__Float16 H5T_NATIVE_FLOAT16_NEG_INF_g;
+#endif
H5_DLLVAR float H5T_NATIVE_FLOAT_POS_INF_g;
H5_DLLVAR float H5T_NATIVE_FLOAT_NEG_INF_g;
H5_DLLVAR double H5T_NATIVE_DOUBLE_POS_INF_g;
@@ -972,6 +985,89 @@ H5_DLL herr_t H5T__conv_ldouble_ullong(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdat
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
size_t bkg_stride, void *buf, void *bkg);
+#ifdef H5_HAVE__FLOAT16
+H5_DLL herr_t H5T__conv_schar__Float16(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata,
+ const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *buf, void *bkg);
+H5_DLL herr_t H5T__conv_uchar__Float16(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata,
+ const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *buf, void *bkg);
+H5_DLL herr_t H5T__conv_short__Float16(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata,
+ const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *buf, void *bkg);
+H5_DLL herr_t H5T__conv_ushort__Float16(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata,
+ const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *buf, void *bkg);
+H5_DLL herr_t H5T__conv_int__Float16(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
+ size_t nelmts, size_t buf_stride, size_t bkg_stride, void *buf,
+ void *bkg);
+H5_DLL herr_t H5T__conv_uint__Float16(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata,
+ const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *buf, void *bkg);
+H5_DLL herr_t H5T__conv_long__Float16(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata,
+ const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *buf, void *bkg);
+H5_DLL herr_t H5T__conv_ulong__Float16(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata,
+ const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *buf, void *bkg);
+H5_DLL herr_t H5T__conv_llong__Float16(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata,
+ const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *buf, void *bkg);
+H5_DLL herr_t H5T__conv_ullong__Float16(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata,
+ const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *buf, void *bkg);
+H5_DLL herr_t H5T__conv_float__Float16(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata,
+ const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *buf, void *bkg);
+H5_DLL herr_t H5T__conv_double__Float16(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata,
+ const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *buf, void *bkg);
+#ifdef H5T_CONV_INTERNAL_LDOUBLE_FLOAT16
+H5_DLL herr_t H5T__conv_ldouble__Float16(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata,
+ const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *buf, void *bkg);
+#endif
+H5_DLL herr_t H5T__conv__Float16_schar(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata,
+ const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *buf, void *bkg);
+H5_DLL herr_t H5T__conv__Float16_uchar(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata,
+ const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *buf, void *bkg);
+H5_DLL herr_t H5T__conv__Float16_short(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata,
+ const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *buf, void *bkg);
+H5_DLL herr_t H5T__conv__Float16_ushort(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata,
+ const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *buf, void *bkg);
+H5_DLL herr_t H5T__conv__Float16_int(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
+ size_t nelmts, size_t buf_stride, size_t bkg_stride, void *buf,
+ void *bkg);
+H5_DLL herr_t H5T__conv__Float16_uint(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata,
+ const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *buf, void *bkg);
+H5_DLL herr_t H5T__conv__Float16_long(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata,
+ const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *buf, void *bkg);
+H5_DLL herr_t H5T__conv__Float16_ulong(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata,
+ const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *buf, void *bkg);
+H5_DLL herr_t H5T__conv__Float16_llong(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata,
+ const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *buf, void *bkg);
+H5_DLL herr_t H5T__conv__Float16_ullong(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata,
+ const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *buf, void *bkg);
+H5_DLL herr_t H5T__conv__Float16_float(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata,
+ const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *buf, void *bkg);
+H5_DLL herr_t H5T__conv__Float16_double(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata,
+ const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *buf, void *bkg);
+H5_DLL herr_t H5T__conv__Float16_ldouble(H5T_t *st, H5T_t *dt, H5T_cdata_t *cdata,
+ const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
+ size_t bkg_stride, void *buf, void *bkg);
+#endif
+
/* Bit twiddling functions */
H5_DLL void H5T__bit_copy(uint8_t *dst, size_t dst_offset, const uint8_t *src, size_t src_offset,
size_t size);
diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h
index abf64d9..2fa261e 100644
--- a/src/H5Tpublic.h
+++ b/src/H5Tpublic.h
@@ -251,6 +251,16 @@ typedef H5T_conv_ret_t (*H5T_conv_except_func_t)(H5T_conv_except_t except_type,
*/
/**
* \ingroup PDTIEEE
+ * 16-bit big-endian IEEE floating-point numbers
+ */
+#define H5T_IEEE_F16BE (H5OPEN H5T_IEEE_F16BE_g)
+/**
+ * \ingroup PDTIEEE
+ * 16-bit little-endian IEEE floating-point numbers
+ */
+#define H5T_IEEE_F16LE (H5OPEN H5T_IEEE_F16LE_g)
+/**
+ * \ingroup PDTIEEE
* 32-bit big-endian IEEE floating-point numbers
*/
#define H5T_IEEE_F32BE (H5OPEN H5T_IEEE_F32BE_g)
@@ -269,6 +279,8 @@ typedef H5T_conv_ret_t (*H5T_conv_except_func_t)(H5T_conv_except_t except_type,
* 64-bit little-endian IEEE floating-point numbers
*/
#define H5T_IEEE_F64LE (H5OPEN H5T_IEEE_F64LE_g)
+H5_DLLVAR hid_t H5T_IEEE_F16BE_g;
+H5_DLLVAR hid_t H5T_IEEE_F16LE_g;
H5_DLLVAR hid_t H5T_IEEE_F32BE_g;
H5_DLLVAR hid_t H5T_IEEE_F32LE_g;
H5_DLLVAR hid_t H5T_IEEE_F64BE_g;
@@ -792,6 +804,11 @@ H5_DLLVAR hid_t H5T_VAX_F64_g;
#define H5T_NATIVE_ULLONG (H5OPEN H5T_NATIVE_ULLONG_g)
/**
* \ingroup PDTNAT
+ * C-style \Code{_Float16}
+ */
+#define H5T_NATIVE_FLOAT16 (H5OPEN H5T_NATIVE_FLOAT16_g)
+/**
+ * \ingroup PDTNAT
* C-style \Code{float}
*/
#define H5T_NATIVE_FLOAT (H5OPEN H5T_NATIVE_FLOAT_g)
@@ -865,6 +882,7 @@ H5_DLLVAR hid_t H5T_NATIVE_LONG_g;
H5_DLLVAR hid_t H5T_NATIVE_ULONG_g;
H5_DLLVAR hid_t H5T_NATIVE_LLONG_g;
H5_DLLVAR hid_t H5T_NATIVE_ULLONG_g;
+H5_DLLVAR hid_t H5T_NATIVE_FLOAT16_g;
H5_DLLVAR hid_t H5T_NATIVE_FLOAT_g;
H5_DLLVAR hid_t H5T_NATIVE_DOUBLE_g;
H5_DLLVAR hid_t H5T_NATIVE_LDOUBLE_g;
@@ -2319,6 +2337,7 @@ H5_DLL htri_t H5Tis_variable_str(hid_t type_id);
* \li #H5T_NATIVE_ULONG
* \li #H5T_NATIVE_ULLONG
*
+ * \li #H5T_NATIVE_FLOAT16 (if available)
* \li #H5T_NATIVE_FLOAT
* \li #H5T_NATIVE_DOUBLE
* \li #H5T_NATIVE_LDOUBLE
diff --git a/src/H5private.h b/src/H5private.h
index 8cc5218..7ede979 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -27,8 +27,6 @@
#include <errno.h>
#include <fcntl.h>
#include <fenv.h>
-#include <float.h>
-#include <math.h>
#include <setjmp.h>
#include <signal.h>
#include <stdio.h>
@@ -36,6 +34,11 @@
#include <string.h>
#include <time.h>
+/* Define __STDC_WANT_IEC_60559_TYPES_EXT__ for _FloatN support, if available */
+#define __STDC_WANT_IEC_60559_TYPES_EXT__
+#include <float.h>
+#include <math.h>
+
/* POSIX headers */
#ifdef H5_HAVE_SYS_TIME_H
#include <sys/time.h>
@@ -459,10 +462,26 @@
#define H5_DBL_ABS_EQUAL(X, Y) (fabs((X) - (Y)) < DBL_EPSILON)
#define H5_LDBL_ABS_EQUAL(X, Y) (fabsl((X) - (Y)) < LDBL_EPSILON)
+#ifdef H5_HAVE__FLOAT16
+#ifdef H5_HAVE_FABSF16
+#define H5_FLT16_ABS_EQUAL(X, Y) (fabsf16((X) - (Y)) < FLT16_EPSILON)
+#else
+#define H5_FLT16_ABS_EQUAL(X, Y) H5_FLT_ABS_EQUAL((float)X, (float)Y)
+#endif
+#endif
+
#define H5_FLT_REL_EQUAL(X, Y, M) (fabsf(((Y) - (X)) / (X)) < (M))
#define H5_DBL_REL_EQUAL(X, Y, M) (fabs(((Y) - (X)) / (X)) < (M))
#define H5_LDBL_REL_EQUAL(X, Y, M) (fabsl(((Y) - (X)) / (X)) < (M))
+#ifdef H5_HAVE__FLOAT16
+#ifdef H5_HAVE_FABSF16
+#define H5_FLT16_REL_EQUAL(X, Y, M) (fabsf16(((Y) - (X)) / (X)) < (M))
+#else
+#define H5_FLT16_REL_EQUAL(X, Y, M) H5_FLT_REL_EQUAL((float)X, (float)Y, M)
+#endif
+#endif
+
/* KiB, MiB, GiB, TiB, PiB, EiB - Used in profiling and timing code */
#define H5_KB (1024.0F)
#define H5_MB (1024.0F * 1024.0F)
@@ -540,6 +559,19 @@
#define H5_GCC_CLANG_DIAG_ON(x)
#endif
+/* If necessary, create a typedef for library usage of the
+ * _Float16 type to avoid issues when compiling the library
+ * with the -pedantic flag or similar where we get warnings
+ * about _Float16 not being an ISO C type.
+ */
+#ifdef H5_HAVE__FLOAT16
+#if defined(__GNUC__)
+__extension__ typedef _Float16 H5__Float16;
+#else
+typedef _Float16 H5__Float16;
+#endif
+#endif
+
/* Function pointer typedef for qsort */
typedef int (*H5_sort_func_cb_t)(const void *, const void *);
@@ -869,7 +901,7 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation);
#ifdef H5_HAVE_VASPRINTF
#define HDvasprintf(RET, FMT, A) vasprintf(RET, FMT, A)
#else
-H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap);
+H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap);
#endif
#endif
diff --git a/src/H5trace.c b/src/H5trace.c
index 86cf92e..d21d82b 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -1657,12 +1657,20 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
H5RS_acat(rs, "H5T_NATIVE_LLONG");
else if (obj == H5T_NATIVE_ULLONG_g)
H5RS_acat(rs, "H5T_NATIVE_ULLONG");
+#ifdef H5_HAVE__FLOAT16
+ else if (obj == H5T_NATIVE_FLOAT16_g)
+ H5RS_acat(rs, "H5T_NATIVE_FLOAT16");
+#endif
else if (obj == H5T_NATIVE_FLOAT_g)
H5RS_acat(rs, "H5T_NATIVE_FLOAT");
else if (obj == H5T_NATIVE_DOUBLE_g)
H5RS_acat(rs, "H5T_NATIVE_DOUBLE");
else if (obj == H5T_NATIVE_LDOUBLE_g)
H5RS_acat(rs, "H5T_NATIVE_LDOUBLE");
+ else if (obj == H5T_IEEE_F16BE_g)
+ H5RS_acat(rs, "H5T_IEEE_F16BE");
+ else if (obj == H5T_IEEE_F16LE_g)
+ H5RS_acat(rs, "H5T_IEEE_F16LE");
else if (obj == H5T_IEEE_F32BE_g)
H5RS_acat(rs, "H5T_IEEE_F32BE");
else if (obj == H5T_IEEE_F32LE_g)
diff --git a/test/API/H5_api_dataset_test.c b/test/API/H5_api_dataset_test.c
index 0f78dff..4ddde286 100644
--- a/test/API/H5_api_dataset_test.c
+++ b/test/API/H5_api_dataset_test.c
@@ -1276,11 +1276,11 @@ test_create_dataset_predefined_types(void)
hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID;
hid_t fspace_id = H5I_INVALID_HID;
hid_t dset_id = H5I_INVALID_HID;
- hid_t predefined_type_test_table[] = {H5T_STD_U8LE, H5T_STD_U8BE, H5T_STD_I8LE, H5T_STD_I8BE,
- H5T_STD_U16LE, H5T_STD_U16BE, H5T_STD_I16LE, H5T_STD_I16BE,
- H5T_STD_U32LE, H5T_STD_U32BE, H5T_STD_I32LE, H5T_STD_I32BE,
- H5T_STD_U64LE, H5T_STD_U64BE, H5T_STD_I64LE, H5T_STD_I64BE,
- H5T_IEEE_F32LE, H5T_IEEE_F32BE, H5T_IEEE_F64LE, H5T_IEEE_F64BE};
+ hid_t predefined_type_test_table[] = {
+ H5T_STD_U8LE, H5T_STD_U8BE, H5T_STD_I8LE, H5T_STD_I8BE, H5T_STD_U16LE, H5T_STD_U16BE,
+ H5T_STD_I16LE, H5T_STD_I16BE, H5T_STD_U32LE, H5T_STD_U32BE, H5T_STD_I32LE, H5T_STD_I32BE,
+ H5T_STD_U64LE, H5T_STD_U64BE, H5T_STD_I64LE, H5T_STD_I64BE, H5T_IEEE_F16LE, H5T_IEEE_F16BE,
+ H5T_IEEE_F32LE, H5T_IEEE_F32BE, H5T_IEEE_F64LE, H5T_IEEE_F64BE};
TESTING("dataset creation with predefined datatypes");
diff --git a/test/API/H5_api_test_util.c b/test/API/H5_api_test_util.c
index d0194f7..41640b4 100644
--- a/test/API/H5_api_test_util.c
+++ b/test/API/H5_api_test_util.c
@@ -44,7 +44,7 @@
/* The number of predefined floating point types in HDF5
*/
-#define NUM_PREDEFINED_FLOAT_TYPES 4
+#define NUM_PREDEFINED_FLOAT_TYPES 6
/* The maximum number of members allowed in an HDF5 compound type, as
* generated by the generate_random_datatype() function, for ease of
@@ -296,15 +296,21 @@ generate_random_datatype_float(H5T_class_t H5_ATTR_UNUSED parent_class, bool H5_
switch (rand() % NUM_PREDEFINED_FLOAT_TYPES) {
case 0:
- type_to_copy = H5T_IEEE_F32BE;
+ type_to_copy = H5T_IEEE_F16BE;
break;
case 1:
- type_to_copy = H5T_IEEE_F32LE;
+ type_to_copy = H5T_IEEE_F16LE;
break;
case 2:
- type_to_copy = H5T_IEEE_F64BE;
+ type_to_copy = H5T_IEEE_F32BE;
break;
case 3:
+ type_to_copy = H5T_IEEE_F32LE;
+ break;
+ case 4:
+ type_to_copy = H5T_IEEE_F64BE;
+ break;
+ case 5:
type_to_copy = H5T_IEEE_F64LE;
break;
diff --git a/test/dt_arith.c b/test/dt_arith.c
index 9870ea1..3c21896 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -62,6 +62,7 @@ typedef enum dtype_t {
INT_ULONG,
INT_LLONG,
INT_ULLONG,
+ FLT_FLOAT16,
FLT_FLOAT,
FLT_DOUBLE,
FLT_LDOUBLE,
@@ -442,6 +443,9 @@ reset_hdf5(void)
SET_ALIGNMENT(FLOAT, H5_SIZEOF_FLOAT);
SET_ALIGNMENT(DOUBLE, H5_SIZEOF_DOUBLE);
SET_ALIGNMENT(LDOUBLE, H5_SIZEOF_LONG_DOUBLE);
+#ifdef H5_HAVE__FLOAT16
+ SET_ALIGNMENT(FLOAT16, H5_SIZEOF__FLOAT16);
+#endif
#endif
}
@@ -575,13 +579,16 @@ expt_handle(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5
{
signed char fill_value1 = 7;
int fill_value2 = 13;
+ short fill_value3 = 25;
if (except_type == H5T_CONV_EXCEPT_RANGE_HI || except_type == H5T_CONV_EXCEPT_RANGE_LOW ||
except_type == H5T_CONV_EXCEPT_TRUNCATE) {
- if (*(bool *)user_data)
+ if (*(int *)user_data == 0)
+ *(int *)dst_buf = fill_value2;
+ else if (*(int *)user_data == 1)
*(signed char *)dst_buf = fill_value1;
else
- *(int *)dst_buf = fill_value2;
+ *(short *)dst_buf = fill_value3;
} /* end if */
return H5T_CONV_HANDLED;
@@ -612,19 +619,34 @@ static int
test_particular_fp_integer(void)
{
hid_t dxpl_id;
- bool flag;
+ int flag;
double src_d = (double)SCHAR_MAX;
signed char dst_c;
- unsigned char *buf1 = NULL, *buf2 = NULL;
- unsigned char *saved_buf1 = NULL, *saved_buf2 = NULL;
- size_t src_size1, src_size2;
- size_t dst_size1, dst_size2;
- float src_f = (float)INT_MAX;
- int dst_i;
- int fill_value = 13;
+ unsigned char *buf1 = NULL;
+ unsigned char *saved_buf1 = NULL;
+ size_t src_size1;
+ size_t dst_size1;
int endian; /*endianness */
unsigned int fails_this_test = 0;
size_t j;
+#ifdef H5_WANT_DCONV_EXCEPTION
+ unsigned char *buf2 = NULL;
+ unsigned char *saved_buf2 = NULL;
+ size_t src_size2;
+ size_t dst_size2;
+ float src_f = (float)INT_MAX;
+ int fill_value = 13;
+ int dst_i;
+#ifdef H5_HAVE__FLOAT16
+ unsigned char *buf3 = NULL;
+ unsigned char *saved_buf3 = NULL;
+ H5__Float16 src_half = (H5__Float16)SHRT_MAX;
+ short s_fill_val = 25;
+ short dst_s;
+ size_t src_size3;
+ size_t dst_size3;
+#endif
+#endif
TESTING("hard particular floating number -> integer conversions");
@@ -685,6 +707,8 @@ test_particular_fp_integer(void)
printf(" %29d\n", y);
}
+/* Only run this part of the test if conversion exceptions are enabled */
+#ifdef H5_WANT_DCONV_EXCEPTION
/* Test conversion from float (the value is INT_MAX) to int. */
src_size2 = H5Tget_size(H5T_NATIVE_FLOAT);
dst_size2 = H5Tget_size(H5T_NATIVE_INT);
@@ -729,6 +753,53 @@ test_particular_fp_integer(void)
printf(" %29d\n", y);
}
+#ifdef H5_HAVE__FLOAT16
+ /* Test conversion from _Float16 (the value is INT_MAX) to int. */
+ src_size3 = H5Tget_size(H5T_NATIVE_FLOAT16);
+ dst_size3 = H5Tget_size(H5T_NATIVE_SHORT);
+ buf3 = (unsigned char *)calloc((size_t)1, (size_t)MAX(src_size3, dst_size3));
+ saved_buf3 = (unsigned char *)calloc((size_t)1, (size_t)MAX(src_size3, dst_size3));
+ memcpy(buf3, &src_half, src_size3);
+ memcpy(saved_buf3, &src_half, src_size3);
+
+ /* Register exception handling function and signal the destination is "short". */
+ flag = 2;
+
+ /* Do conversion */
+ if (H5Tconvert(H5T_NATIVE_FLOAT16, H5T_NATIVE_SHORT, (size_t)1, buf3, NULL, dxpl_id) < 0) {
+ H5_FAILED();
+ printf("Can't convert data\n");
+ goto error;
+ }
+
+ memcpy(&dst_s, buf3, dst_size3);
+
+ /* Print errors */
+ if (dst_s != s_fill_val) {
+ H5__Float16 x;
+ short y;
+
+ if (0 == fails_this_test++)
+ H5_FAILED();
+
+ printf(" test _Float16 to short:\n");
+ printf(" src = ");
+ for (j = 0; j < src_size3; j++)
+ printf(" %02x", saved_buf3[ENDIAN(src_size3, j, endian)]);
+
+ memcpy(&x, saved_buf3, src_size3);
+ printf(" %29.20e\n", (double)x);
+
+ printf(" dst = ");
+ for (j = 0; j < dst_size3; j++)
+ printf(" %02x", buf3[ENDIAN(dst_size3, j, endian)]);
+
+ memcpy(&y, buf3, dst_size3);
+ printf(" %29d\n", (int)y);
+ }
+#endif
+#endif
+
if (fails_this_test)
goto error;
@@ -740,12 +811,27 @@ test_particular_fp_integer(void)
if (buf1)
free(buf1);
+
+#ifdef H5_WANT_DCONV_EXCEPTION
if (buf2)
free(buf2);
+#ifdef H5_HAVE__FLOAT16
+ if (buf3)
+ free(buf3);
+#endif
+#endif
+
if (saved_buf1)
free(saved_buf1);
+
+#ifdef H5_WANT_DCONV_EXCEPTION
if (saved_buf2)
free(saved_buf2);
+#ifdef H5_HAVE__FLOAT16
+ if (saved_buf3)
+ free(saved_buf3);
+#endif
+#endif
PASSED();
return 0;
@@ -759,12 +845,27 @@ error:
H5E_END_TRY
if (buf1)
free(buf1);
+
+#ifdef H5_WANT_DCONV_EXCEPTION
if (buf2)
free(buf2);
+#ifdef H5_HAVE__FLOAT16
+ if (buf3)
+ free(buf3);
+#endif
+#endif
+
if (saved_buf1)
free(saved_buf1);
+
+#ifdef H5_WANT_DCONV_EXCEPTION
if (saved_buf2)
free(saved_buf2);
+#ifdef H5_HAVE__FLOAT16
+ if (saved_buf3)
+ free(saved_buf3);
+#endif
+#endif
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
@@ -1532,17 +1633,16 @@ error:
* Function: test_conv_int_1
*
* Purpose: Test conversion of integer values from SRC to DST.
- * These types should be any combination of:
+ * These types should be any combination of:
*
* H5T_NATIVE_SCHAR H5T_NATIVE_UCHAR
- * H5T_NATIVE_SHORT H5T_NATIVE_USHORT
- * H5T_NATIVE_INT H5T_NATIVE_UINT
- * H5T_NATIVE_LONG H5T_NATIVE_ULONG
- * H5T_NATIVE_LLONG H5T_NATIVE_ULLONG
+ * H5T_NATIVE_SHORT H5T_NATIVE_USHORT
+ * H5T_NATIVE_INT H5T_NATIVE_UINT
+ * H5T_NATIVE_LONG H5T_NATIVE_ULONG
+ * H5T_NATIVE_LLONG H5T_NATIVE_ULLONG
*
* Return: Success: 0
- *
- * Failure: number of errors
+ * Failure: number of errors
*
*-------------------------------------------------------------------------
*/
@@ -1783,6 +1883,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
memcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
hw_char = (signed char)(*((unsigned long long *)aligned));
break;
+ case FLT_FLOAT16:
case FLT_FLOAT:
case FLT_DOUBLE:
case FLT_LDOUBLE:
@@ -1835,6 +1936,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
memcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
hw_uchar = (unsigned char)(*((unsigned long long *)aligned));
break;
+ case FLT_FLOAT16:
case FLT_FLOAT:
case FLT_DOUBLE:
case FLT_LDOUBLE:
@@ -1887,7 +1989,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
memcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
hw_short = (short)(*((unsigned long long *)aligned));
break;
-
+ case FLT_FLOAT16:
case FLT_FLOAT:
case FLT_DOUBLE:
case FLT_LDOUBLE:
@@ -1940,6 +2042,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
memcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
hw_ushort = (unsigned short)(*((unsigned long long *)aligned));
break;
+ case FLT_FLOAT16:
case FLT_FLOAT:
case FLT_DOUBLE:
case FLT_LDOUBLE:
@@ -1992,6 +2095,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
memcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
hw_int = (int)(*((unsigned long long *)aligned));
break;
+ case FLT_FLOAT16:
case FLT_FLOAT:
case FLT_DOUBLE:
case FLT_LDOUBLE:
@@ -2044,6 +2148,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
memcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
hw_uint = (unsigned int)(*((unsigned long long *)aligned));
break;
+ case FLT_FLOAT16:
case FLT_FLOAT:
case FLT_DOUBLE:
case FLT_LDOUBLE:
@@ -2096,6 +2201,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
memcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
hw_long = (long int)(*((unsigned long long *)aligned));
break;
+ case FLT_FLOAT16:
case FLT_FLOAT:
case FLT_DOUBLE:
case FLT_LDOUBLE:
@@ -2148,6 +2254,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
memcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
hw_ulong = (unsigned long)(*((unsigned long long *)aligned));
break;
+ case FLT_FLOAT16:
case FLT_FLOAT:
case FLT_DOUBLE:
case FLT_LDOUBLE:
@@ -2200,6 +2307,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
memcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
hw_llong = (long long)(*((unsigned long long *)aligned));
break;
+ case FLT_FLOAT16:
case FLT_FLOAT:
case FLT_DOUBLE:
case FLT_LDOUBLE:
@@ -2252,6 +2360,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
memcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
hw_ullong = (unsigned long long)(*((unsigned long long *)aligned));
break;
+ case FLT_FLOAT16:
case FLT_FLOAT:
case FLT_DOUBLE:
case FLT_LDOUBLE:
@@ -2434,6 +2543,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
memcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
fprintf(stdout, " %29llu\n", *((unsigned long long *)aligned));
break;
+ case FLT_FLOAT16:
case FLT_FLOAT:
case FLT_DOUBLE:
case FLT_LDOUBLE:
@@ -2488,6 +2598,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
memcpy(aligned, buf + j * sizeof(long long), sizeof(unsigned long long));
fprintf(stdout, " %29llu\n", *((unsigned long long *)aligned));
break;
+ case FLT_FLOAT16:
case FLT_FLOAT:
case FLT_DOUBLE:
case FLT_LDOUBLE:
@@ -2532,6 +2643,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
case INT_ULLONG:
fprintf(stdout, " %29llu\n", *((unsigned long long *)((void *)hw)));
break;
+ case FLT_FLOAT16:
case FLT_FLOAT:
case FLT_DOUBLE:
case FLT_LDOUBLE:
@@ -2664,6 +2776,15 @@ my_isnan(dtype_t type, void *val)
retval = isnan(x);
#endif
}
+ else if (FLT_FLOAT16 == type) {
+#ifdef H5_HAVE__FLOAT16
+ H5__Float16 x;
+ memcpy(&x, val, sizeof(H5__Float16));
+ retval = isnan(x);
+#else
+ assert(0 && "Should not reach this point!");
+#endif
+ }
else {
return 0;
}
@@ -2693,6 +2814,16 @@ my_isnan(dtype_t type, void *val)
snprintf(s, sizeof(s), "%Lg", x);
#endif
}
+ else if (FLT_FLOAT16 == type) {
+#ifdef H5_HAVE__FLOAT16
+ H5__Float16 x;
+
+ memcpy(&x, val, sizeof(H5__Float16));
+ snprintf(s, sizeof(s), "%g", (double)x);
+#else
+ assert(0 && "Should not reach this point!");
+#endif
+ }
else {
return 0;
}
@@ -2735,15 +2866,317 @@ my_isinf(int endian, const unsigned char *val, size_t size, size_t mpos, size_t
}
/*-------------------------------------------------------------------------
+ * Function: test_conv_flt_1_hw_conv_from_flt16
+ *
+ * Purpose: Helper function for test_conv_flt_1 to perform conversion
+ * from _Float16 to another type by casting. Also checks for
+ * overflow and underflow when the destination type is a type
+ * with a smaller width than _Float16.
+ *
+ * Return: -1 on failure
+ * 0 on success without overflow or underflow
+ * 1 on overflow
+ * 2 on underflow
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifdef H5_HAVE__FLOAT16
+static int
+test_conv_flt_1_hw_conv_from_flt16(void *hw_dst, unsigned char *src_buf, size_t idx, dtype_t dst_type)
+{
+ H5__Float16 aligned;
+ int ret = 0;
+
+ memcpy(&aligned, src_buf + idx * sizeof(H5__Float16), sizeof(H5__Float16));
+
+ switch (dst_type) {
+ case FLT_FLOAT16:
+ *((H5__Float16 *)hw_dst) = aligned;
+ break;
+ case FLT_FLOAT:
+ *((float *)hw_dst) = (float)aligned;
+ break;
+ case FLT_DOUBLE:
+ *((double *)hw_dst) = (double)aligned;
+ break;
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
+ case FLT_LDOUBLE:
+ *((long double *)hw_dst) = (long double)aligned;
+ break;
+#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
+ default:
+ H5_FAILED();
+ printf("invalid destination conversion datatype");
+ ret = -1;
+ goto done;
+ }
+
+done:
+ return ret;
+}
+#endif
+
+/*-------------------------------------------------------------------------
+ * Function: test_conv_flt_1_hw_conv_from_flt
+ *
+ * Purpose: Helper function for test_conv_flt_1 to perform conversion
+ * from float to another type by casting. Also checks for
+ * overflow and underflow when the destination type is a
+ * type with a smaller width than float.
+ *
+ * Return: -1 on failure
+ * 0 on success without overflow or underflow
+ * 1 on overflow
+ * 2 on underflow
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_conv_flt_1_hw_conv_from_flt(void *hw_dst, unsigned char *src_buf, size_t idx, dtype_t dst_type)
+{
+ float aligned;
+ int ret = 0;
+
+ memcpy(&aligned, src_buf + idx * sizeof(float), sizeof(float));
+
+ switch (dst_type) {
+ case FLT_FLOAT:
+ *((float *)hw_dst) = aligned;
+ break;
+ case FLT_DOUBLE:
+ *((double *)hw_dst) = (double)aligned;
+ break;
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
+ case FLT_LDOUBLE:
+ *((long double *)hw_dst) = (long double)aligned;
+ break;
+#endif
+ case FLT_FLOAT16:
+#ifdef H5_HAVE__FLOAT16
+ /* Suppress warning about non-standard floating-point literal suffix */
+ H5_GCC_CLANG_DIAG_OFF("pedantic")
+
+ *((H5__Float16 *)hw_dst) = (H5__Float16)aligned;
+
+ /* Check for overflow and underflow */
+ if (fabsf(aligned) > (float)FLT16_MAX)
+ ret = 1;
+ else if (fabsf(aligned) < (float)FLT16_MIN)
+ ret = 2;
+
+ H5_GCC_CLANG_DIAG_ON("pedantic")
+ break;
+#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
+ default:
+ H5_FAILED();
+ printf("invalid destination conversion datatype");
+ ret = -1;
+ goto done;
+ }
+
+done:
+ return ret;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: test_conv_flt_1_hw_conv_from_double
+ *
+ * Purpose: Helper function for test_conv_flt_1 to perform conversion
+ * from double to another type by casting. Also checks for
+ * overflow and underflow when the destination type is a
+ * type with a smaller width than double.
+ *
+ * Return: -1 on failure
+ * 0 on success without overflow or underflow
+ * 1 on overflow
+ * 2 on underflow
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_conv_flt_1_hw_conv_from_double(void *hw_dst, unsigned char *src_buf, size_t idx, dtype_t dst_type)
+{
+ double aligned;
+ int ret = 0;
+
+ memcpy(&aligned, src_buf + idx * sizeof(double), sizeof(double));
+
+ switch (dst_type) {
+ case FLT_FLOAT:
+ *((float *)hw_dst) = (float)aligned;
+
+ /* Check for overflow and underflow */
+ if (fabs(aligned) > (double)FLT_MAX)
+ ret = 1;
+ else if (fabs(aligned) < (double)FLT_MIN)
+ ret = 2;
+
+ break;
+ case FLT_DOUBLE:
+ *((double *)hw_dst) = aligned;
+ break;
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
+ case FLT_LDOUBLE:
+ *((long double *)hw_dst) = (long double)aligned;
+ break;
+#endif
+ case FLT_FLOAT16:
+#ifdef H5_HAVE__FLOAT16
+ /* Suppress warning about non-standard floating-point literal suffix */
+ H5_GCC_CLANG_DIAG_OFF("pedantic")
+
+ *((H5__Float16 *)hw_dst) = (H5__Float16)aligned;
+
+ /* Check for overflow and underflow */
+ if (fabs(aligned) > (double)FLT16_MAX)
+ ret = 1;
+ else if (fabs(aligned) < (double)FLT16_MIN)
+ ret = 2;
+
+ H5_GCC_CLANG_DIAG_ON("pedantic")
+ break;
+#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
+ default:
+ H5_FAILED();
+ printf("invalid destination conversion datatype");
+ ret = -1;
+ goto done;
+ }
+
+done:
+ return ret;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: test_conv_flt_1_hw_conv_from_ldouble
+ *
+ * Purpose: Helper function for test_conv_flt_1 to perform conversion
+ * from long double to another type by casting. Also checks
+ * for overflow and underflow when the destination type is a
+ * type with a smaller width than long double.
+ *
+ * Return: -1 on failure
+ * 0 on success without overflow or underflow
+ * 1 on overflow
+ * 2 on underflow
+ *
+ *-------------------------------------------------------------------------
+ */
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
+static int
+test_conv_flt_1_hw_conv_from_ldouble(void *hw_dst, unsigned char *src_buf, size_t idx, dtype_t dst_type)
+{
+ long double aligned;
+ int ret = 0;
+
+ memcpy(&aligned, src_buf + idx * sizeof(long double), sizeof(long double));
+
+ switch (dst_type) {
+ case FLT_FLOAT:
+ *((float *)hw_dst) = (float)aligned;
+
+ /* Check for overflow and underflow */
+ if (fabsl(aligned) > (long double)FLT_MAX)
+ ret = 1;
+ else if (fabsl(aligned) < (long double)FLT_MIN)
+ ret = 2;
+
+ break;
+ case FLT_DOUBLE:
+ *((double *)hw_dst) = (double)aligned;
+
+ /* Check for overflow and underflow */
+ if (fabsl(aligned) > (long double)DBL_MAX)
+ ret = 1;
+ else if (fabsl(aligned) < (long double)DBL_MIN)
+ ret = 2;
+
+ break;
+ case FLT_LDOUBLE:
+ *((long double *)hw_dst) = aligned;
+ break;
+ case FLT_FLOAT16:
+#ifdef H5_HAVE__FLOAT16
+ /* Suppress warning about non-standard floating-point literal suffix */
+ H5_GCC_CLANG_DIAG_OFF("pedantic")
+
+ *((H5__Float16 *)hw_dst) = (H5__Float16)aligned;
+
+ /* Check for overflow and underflow */
+ if (fabsl(aligned) > (long double)FLT16_MAX)
+ ret = 1;
+ else if (fabsl(aligned) < (long double)FLT16_MIN)
+ ret = 2;
+
+ H5_GCC_CLANG_DIAG_ON("pedantic")
+ break;
+#endif
+ case INT_SCHAR:
+ case INT_UCHAR:
+ case INT_SHORT:
+ case INT_USHORT:
+ case INT_INT:
+ case INT_UINT:
+ case INT_LONG:
+ case INT_ULONG:
+ case INT_LLONG:
+ case INT_ULLONG:
+ case OTHER:
+ default:
+ H5_FAILED();
+ printf("invalid destination conversion datatype");
+ ret = -1;
+ goto done;
+ }
+
+done:
+ return ret;
+}
+#endif
+
+/*-------------------------------------------------------------------------
* Function: test_conv_flt_1
*
* Purpose: Test conversion of floating point values from SRC to
- * DST. These types should be H5T_NATIVE_FLOAT,
- * H5T_NATIVE_DOUBLE, or H5T_NATIVE_LDOUBLE.
+ * DST. These types should be H5T_NATIVE_FLOAT,
+ * H5T_NATIVE_DOUBLE, H5T_NATIVE_LDOUBLE or H5T_NATIVE_FLOAT16,
+ * if available.
*
* Return: Success: 0
- *
- * Failure: number of errors
+ * Failure: number of errors
*
*-------------------------------------------------------------------------
*/
@@ -2762,8 +3195,12 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst)
unsigned char *saved = NULL; /*original values */
char str[256]; /*hello string */
void *aligned = NULL; /*aligned buffer */
- float hw_f; /*hardware-converted */
- double hw_d; /*hardware-converted */
+ void *hw_p = NULL;
+ float hw_f; /*hardware-converted */
+ double hw_d; /*hardware-converted */
+#ifdef H5_HAVE__FLOAT16
+ H5__Float16 hw_half;
+#endif
#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
long double hw_ld; /*hardware-converted */
#endif
@@ -2841,6 +3278,12 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst)
src_type = FLT_LDOUBLE;
#endif
}
+#ifdef H5_HAVE__FLOAT16
+ else if (H5Tequal(src, H5T_NATIVE_FLOAT16)) {
+ src_type_name = "_Float16";
+ src_type = FLT_FLOAT16;
+ }
+#endif
else {
src_type_name = "UNKNOWN";
src_type = OTHER;
@@ -2860,6 +3303,12 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst)
dst_type = FLT_LDOUBLE;
#endif
}
+#ifdef H5_HAVE__FLOAT16
+ else if (H5Tequal(dst, H5T_NATIVE_FLOAT16)) {
+ dst_type_name = "_Float16";
+ dst_type = FLT_FLOAT16;
+ }
+#endif
else {
dst_type_name = "UNKNOWN";
dst_type = OTHER;
@@ -2941,6 +3390,23 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst)
dst_size, buf, saved, nelmts);
#endif
}
+ else if (src_type == FLT_FLOAT16) {
+#ifdef H5_HAVE__FLOAT16
+ /* Suppress warning about non-standard floating-point literal suffix */
+ H5_GCC_CLANG_DIAG_OFF("pedantic")
+ /* Suppress warning about float conversion in macro code path
+ * that sets H5__Float16 multiply = 100000000;, which shouldn't
+ * happen due to the small value of FLT16_MAX_10_EXP.
+ */
+ H5_GCC_CLANG_DIAG_OFF("float-conversion")
+ INIT_FP_NORM(H5__Float16, FLT16_MAX, FLT16_MIN, FLT16_MAX_10_EXP, FLT16_MIN_10_EXP, src_size,
+ dst_size, buf, saved, nelmts);
+ H5_GCC_CLANG_DIAG_ON("float-conversion")
+ H5_GCC_CLANG_DIAG_ON("pedantic")
+#else
+ assert(0 && "Should not reach this point!");
+#endif
+ }
else
goto error;
@@ -2960,6 +3426,14 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst)
nelmts);
#endif
}
+ else if (src_type == FLT_FLOAT16) {
+#ifdef H5_HAVE__FLOAT16
+ INIT_FP_DENORM(H5__Float16, FLT16_MANT_DIG, src_size, src_nbits, sendian, dst_size, buf,
+ saved, nelmts);
+#else
+ assert(0 && "Should not reach this point!");
+#endif
+ }
else
goto error;
@@ -2977,6 +3451,13 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst)
INIT_FP_SPECIAL(src_size, src_nbits, sendian, LDBL_MANT_DIG, dst_size, buf, saved, nelmts);
#endif
}
+ else if (src_type == FLT_FLOAT16) {
+#ifdef H5_HAVE__FLOAT16
+ INIT_FP_SPECIAL(src_size, src_nbits, sendian, FLT16_MANT_DIG, dst_size, buf, saved, nelmts);
+#else
+ assert(0 && "Should not reach this point!");
+#endif
+ }
else
goto error;
@@ -2989,74 +3470,62 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst)
if (H5Tconvert(src, dst, nelmts, buf, NULL, H5P_DEFAULT) < 0)
goto error;
+ /* Set pointer to matching type for hardware conversion */
+ if (FLT_FLOAT == dst_type)
+ hw_p = &hw_f;
+ else if (FLT_DOUBLE == dst_type)
+ hw_p = &hw_d;
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
+ else if (FLT_LDOUBLE == dst_type)
+ hw_p = &hw_ld;
+#endif
+#ifdef H5_HAVE__FLOAT16
+ else if (FLT_FLOAT16 == dst_type)
+ hw_p = &hw_half;
+#endif
+ else
+ goto error;
+
+ /* Set convenience pointer for indexing into bytes of matching type */
+ hw = (unsigned char *)hw_p;
+
/* Check the software results against the hardware */
for (j = 0; j < nelmts; j++) {
- underflow = 0;
- hw_f = 911.0F;
- hw_d = 911.0;
+ int conv_ret = -1;
+
+ hw_f = 911.0F;
+ hw_d = 911.0;
#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
hw_ld = 911.0L;
#endif
+#ifdef H5_HAVE__FLOAT16
+ hw_half = 911.0;
+#endif
/* The hardware conversion */
- /* Check for underflow when src is a "larger" float than dst.*/
- if (FLT_FLOAT == src_type) {
- memcpy(aligned, saved + j * sizeof(float), sizeof(float));
- if (FLT_FLOAT == dst_type) {
- hw_f = *((float *)aligned);
- hw = (unsigned char *)&hw_f;
- }
- else if (FLT_DOUBLE == dst_type) {
- hw_d = (double)*((float *)aligned);
- hw = (unsigned char *)&hw_d;
-#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
- }
- else {
- hw_ld = (long double)*((float *)aligned);
- hw = (unsigned char *)&hw_ld;
+#ifdef H5_HAVE__FLOAT16
+ if (FLT_FLOAT16 == src_type) {
+ conv_ret = test_conv_flt_1_hw_conv_from_flt16(hw_p, saved, j, dst_type);
+ }
+ else
#endif
- }
+ if (FLT_FLOAT == src_type) {
+ conv_ret = test_conv_flt_1_hw_conv_from_flt(hw_p, saved, j, dst_type);
}
else if (FLT_DOUBLE == src_type) {
- memcpy(aligned, saved + j * sizeof(double), sizeof(double));
- if (FLT_FLOAT == dst_type) {
- hw_f = (float)(*((double *)aligned));
- hw = (unsigned char *)&hw_f;
- underflow = fabs(*((double *)aligned)) < (double)FLT_MIN;
- overflow = fabs(*((double *)aligned)) > (double)FLT_MAX;
- }
- else if (FLT_DOUBLE == dst_type) {
- hw_d = *((double *)aligned);
- hw = (unsigned char *)&hw_d;
-#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
- }
- else {
- hw_ld = (long double)*((double *)aligned);
- hw = (unsigned char *)&hw_ld;
-#endif
- }
+ conv_ret = test_conv_flt_1_hw_conv_from_double(hw_p, saved, j, dst_type);
+ }
#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
+ else if (FLT_LDOUBLE == src_type) {
+ conv_ret = test_conv_flt_1_hw_conv_from_ldouble(hw_p, saved, j, dst_type);
}
- else {
- memcpy(aligned, saved + j * sizeof(long double), sizeof(long double));
- if (FLT_FLOAT == dst_type) {
- hw_f = (float)*((long double *)aligned);
- hw = (unsigned char *)&hw_f;
- underflow = fabsl(*((long double *)aligned)) < (long double)FLT_MIN;
- overflow = fabsl(*((long double *)aligned)) > (long double)FLT_MAX;
- }
- else if (FLT_DOUBLE == dst_type) {
- hw_d = (double)*((long double *)aligned);
- hw = (unsigned char *)&hw_d;
- underflow = fabsl(*((long double *)aligned)) < (long double)DBL_MIN;
- overflow = fabsl(*((long double *)aligned)) > (long double)DBL_MAX;
- }
- else {
- hw_ld = *((long double *)aligned);
- hw = (unsigned char *)&hw_ld;
- }
#endif
- }
+
+ if (conv_ret < 0)
+ goto error;
+
+ overflow = (conv_ret == 1);
+ underflow = (conv_ret == 2);
/* For Intel machines, the size of "long double" is 12 bytes, precision
* is 80 bits; for Intel IA64 and AMD processors, the size of "long double"
@@ -3099,6 +3568,12 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst)
continue;
#endif
}
+#ifdef H5_HAVE__FLOAT16
+ else if (FLT_FLOAT16 == dst_type && my_isnan(dst_type, buf + j * sizeof(H5__Float16)) &&
+ my_isnan(dst_type, hw)) {
+ continue;
+ }
+#endif
/*
* Assume same if hardware result is NaN. This is because the
@@ -3148,7 +3623,7 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst)
check_mant[1] = frexp(hw_d, check_expo + 1);
#if (H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE)
}
- else {
+ else if (FLT_LDOUBLE == dst_type) {
long double x = 0.0L;
memcpy(&x, &buf[j * dst_size], sizeof(long double));
/* dst is largest float, no need to check underflow. */
@@ -3156,6 +3631,35 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst)
check_mant[1] = (double)frexpl(hw_ld, check_expo + 1);
#endif
}
+ else if (FLT_FLOAT16 == dst_type) {
+#ifdef H5_HAVE__FLOAT16
+ H5__Float16 x;
+ memcpy(&x, &buf[j * dst_size], sizeof(H5__Float16));
+
+ /* Suppress warning about non-standard floating-point literal suffix */
+ H5_GCC_CLANG_DIAG_OFF("pedantic")
+#ifdef H5_HAVE_FABSF16
+ if (underflow && fabsf16(x) <= FLT16_MIN && fabsf16(hw_half) <= FLT16_MIN)
+ continue; /* all underflowed, no error */
+#else
+ if (underflow && fabsf((float)x) <= (float)FLT16_MIN &&
+ fabsf((float)hw_half) <= (float)FLT16_MIN)
+ continue; /* all underflowed, no error */
+#endif
+ H5_GCC_CLANG_DIAG_ON("pedantic")
+
+ if (overflow && my_isinf(dendian, buf + j * sizeof(H5__Float16), dst_size, dst_mpos,
+ dst_msize, dst_epos, dst_esize))
+ continue; /* all overflowed, no error */
+ check_mant[0] = (double)frexpf((float)x, check_expo + 0);
+ check_mant[1] = (double)frexpf((float)hw_half, check_expo + 1);
+#else
+ assert(0 && "Should not reach this point!");
+#endif
+ }
+ else
+ goto error;
+
/* Special check for denormalized values */
if (check_expo[0] < (-(int)dst_ebias) || check_expo[1] < (-(int)dst_ebias)) {
int expo_diff = check_expo[0] - check_expo[1];
@@ -3206,12 +3710,23 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst)
printf(" %29.20e\n", x);
#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
}
- else {
+ else if (FLT_LDOUBLE == src_type) {
long double x = 0.0L;
memcpy(&x, &saved[j * src_size], sizeof(long double));
fprintf(stdout, " %29.20Le\n", x);
#endif
}
+ else if (FLT_FLOAT16 == src_type) {
+#ifdef H5_HAVE__FLOAT16
+ H5__Float16 x;
+ memcpy(&x, &saved[j * src_size], sizeof(H5__Float16));
+ printf(" %29.20e\n", (double)x);
+#else
+ assert(0 && "Should not reach this point!");
+#endif
+ }
+ else
+ goto error;
printf(" dst =");
for (k = 0; k < dst_size; k++)
@@ -3228,12 +3743,23 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst)
printf(" %29.20e\n", x);
#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
}
- else {
+ else if (FLT_LDOUBLE == src_type) {
long double x = 0.0L;
memcpy(&x, &buf[j * dst_size], sizeof(long double));
fprintf(stdout, " %29.20Le\n", x);
#endif
}
+ else if (FLT_FLOAT16 == src_type) {
+#ifdef H5_HAVE__FLOAT16
+ H5__Float16 x;
+ memcpy(&x, &buf[j * dst_size], sizeof(H5__Float16));
+ printf(" %29.20e\n", (double)x);
+#else
+ assert(0 && "Should not reach this point!");
+#endif
+ }
+ else
+ goto error;
printf(" ans =");
for (k = 0; k < dst_size; k++)
@@ -3244,9 +3770,15 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst)
else if (FLT_DOUBLE == dst_type)
printf(" %29.20e\n", hw_d);
#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
- else
+ else if (FLT_LDOUBLE == dst_type)
fprintf(stdout, " %29.20Le\n", hw_ld);
#endif
+#ifdef H5_HAVE__FLOAT16
+ else if (FLT_FLOAT16 == dst_type)
+ printf(" %29.20e\n", (double)hw_half);
+#endif
+ else
+ goto error;
/* If the source is normalized values, print out error message; if it is
* denormalized or special values, print out warning message.*/
@@ -3326,17 +3858,16 @@ error:
* Function: test_conv_int_fp
*
* Purpose: Test conversion between integer and float values
- * from SRC to DST. These types should be any combination of:
+ * from SRC to DST. These types should be any combination of:
*
* H5T_NATIVE_SCHAR H5T_NATIVE_FLOAT
- * H5T_NATIVE_SHORT H5T_NATIVE_DOUBLE
- * H5T_NATIVE_INT H5T_NATIVE_LDOUBLE
- * H5T_NATIVE_LONG
- * H5T_NATIVE_LLONG
+ * H5T_NATIVE_SHORT H5T_NATIVE_DOUBLE
+ * H5T_NATIVE_INT H5T_NATIVE_LDOUBLE
+ * H5T_NATIVE_LONG
+ * H5T_NATIVE_LLONG
*
* Return: Success: 0
- *
- * Failure: number of errors
+ * Failure: number of errors
*
*-------------------------------------------------------------------------
*/
@@ -3382,6 +3913,9 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
unsigned long hw_ulong = 0;
long long hw_llong = 0;
unsigned long long hw_ullong = 0;
+#ifdef H5_HAVE__FLOAT16
+ H5__Float16 hw_half;
+#endif
/* What is the name of the source type */
if (H5Tequal(src, H5T_NATIVE_SCHAR)) {
@@ -3438,6 +3972,12 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
src_type = FLT_LDOUBLE;
#endif
}
+#ifdef H5_HAVE__FLOAT16
+ else if (H5Tequal(src, H5T_NATIVE_FLOAT16)) {
+ src_type_name = "_Float16";
+ src_type = FLT_FLOAT16;
+ }
+#endif
else {
src_type_name = "UNKNOWN";
src_type = OTHER;
@@ -3498,6 +4038,12 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
dst_type = FLT_LDOUBLE;
#endif
}
+#ifdef H5_HAVE__FLOAT16
+ else if (H5Tequal(dst, H5T_NATIVE_FLOAT16)) {
+ dst_type_name = "_Float16";
+ dst_type = FLT_FLOAT16;
+ }
+#endif
else {
dst_type_name = "UNKNOWN";
dst_type = OTHER;
@@ -3515,7 +4061,8 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
if ((INT_SCHAR == src_type || INT_UCHAR == src_type || INT_SHORT == src_type || INT_USHORT == src_type ||
INT_INT == src_type || INT_UINT == src_type || INT_LONG == src_type || INT_ULONG == src_type ||
INT_LLONG == src_type || INT_ULLONG == src_type) &&
- (FLT_FLOAT != dst_type && FLT_DOUBLE != dst_type && FLT_LDOUBLE != dst_type)) {
+ (FLT_FLOAT != dst_type && FLT_DOUBLE != dst_type && FLT_LDOUBLE != dst_type &&
+ FLT_FLOAT16 != dst_type)) {
snprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name);
printf("%-70s", str);
H5_FAILED();
@@ -3523,7 +4070,8 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
goto error;
}
- if ((FLT_FLOAT == src_type || FLT_DOUBLE == src_type || FLT_LDOUBLE == src_type) &&
+ if ((FLT_FLOAT == src_type || FLT_DOUBLE == src_type || FLT_LDOUBLE == src_type ||
+ FLT_FLOAT16 == src_type) &&
(INT_SCHAR != dst_type && INT_UCHAR != dst_type && INT_SHORT != dst_type && INT_USHORT != dst_type &&
INT_INT != dst_type && INT_UINT != dst_type && INT_LONG != dst_type && INT_ULONG != dst_type &&
INT_LLONG != dst_type && INT_ULLONG != dst_type)) {
@@ -3671,6 +4219,32 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
}
#endif
}
+ else if (src_type == FLT_FLOAT16) {
+#ifdef H5_HAVE__FLOAT16
+ if (run_test == TEST_NORMAL) {
+ /* Suppress warning about non-standard floating-point literal suffix */
+ H5_GCC_CLANG_DIAG_OFF("pedantic")
+ /* Suppress warning about float conversion in macro code path
+ * that sets H5__Float16 multiply = 100000000;, which shouldn't
+ * happen due to the small value of FLT16_MAX_10_EXP.
+ */
+ H5_GCC_CLANG_DIAG_OFF("float-conversion")
+ INIT_FP_NORM(H5__Float16, FLT16_MAX, FLT16_MIN, FLT16_MAX_10_EXP, FLT16_MIN_10_EXP, src_size,
+ dst_size, buf, saved, nelmts);
+ H5_GCC_CLANG_DIAG_ON("float-conversion")
+ H5_GCC_CLANG_DIAG_ON("pedantic")
+ }
+ else if (run_test == TEST_DENORM) {
+ INIT_FP_DENORM(H5__Float16, FLT16_MANT_DIG, src_size, src_nbits, sendian, dst_size, buf, saved,
+ nelmts);
+ }
+ else {
+ INIT_FP_SPECIAL(src_size, src_nbits, sendian, FLT16_MANT_DIG, dst_size, buf, saved, nelmts);
+ }
+#else
+ assert(0 && "Should not reach this point!");
+#endif
+ }
else
goto error;
@@ -3680,7 +4254,8 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
/* Check the results from the library against hardware */
for (j = 0; j < nelmts; j++) {
- if (FLT_FLOAT == src_type || FLT_DOUBLE == src_type || FLT_LDOUBLE == src_type)
+ if (FLT_FLOAT == src_type || FLT_DOUBLE == src_type || FLT_LDOUBLE == src_type ||
+ FLT_FLOAT16 == src_type)
if (my_isnan(src_type, saved + j * src_size))
continue;
@@ -3727,6 +4302,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
memcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
hw_float = (float)(*((unsigned long long *)aligned));
break;
+ case FLT_FLOAT16:
case FLT_FLOAT:
case FLT_DOUBLE:
case FLT_LDOUBLE:
@@ -3779,6 +4355,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
memcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
hw_double = (double)(*((unsigned long long *)aligned));
break;
+ case FLT_FLOAT16:
case FLT_FLOAT:
case FLT_DOUBLE:
case FLT_LDOUBLE:
@@ -3831,6 +4408,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
memcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
hw_ldouble = (long double)(*((unsigned long long *)aligned));
break;
+ case FLT_FLOAT16:
case FLT_FLOAT:
case FLT_DOUBLE:
case FLT_LDOUBLE:
@@ -3840,6 +4418,63 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
break;
}
}
+ else if (FLT_FLOAT16 == dst_type) {
+#ifdef H5_HAVE__FLOAT16
+ hw = (unsigned char *)&hw_half;
+ switch (src_type) {
+ case INT_SCHAR:
+ memcpy(aligned, saved + j * sizeof(signed char), sizeof(signed char));
+ hw_half = (H5__Float16)(*((signed char *)aligned));
+ break;
+ case INT_UCHAR:
+ memcpy(aligned, saved + j * sizeof(unsigned char), sizeof(unsigned char));
+ hw_half = (H5__Float16)(*((unsigned char *)aligned));
+ break;
+ case INT_SHORT:
+ memcpy(aligned, saved + j * sizeof(short), sizeof(short));
+ hw_half = (H5__Float16)(*((short *)aligned));
+ break;
+ case INT_USHORT:
+ memcpy(aligned, saved + j * sizeof(unsigned short), sizeof(unsigned short));
+ hw_half = (H5__Float16)(*((unsigned short *)aligned));
+ break;
+ case INT_INT:
+ memcpy(aligned, saved + j * sizeof(int), sizeof(int));
+ hw_half = (H5__Float16)(*((int *)aligned));
+ break;
+ case INT_UINT:
+ memcpy(aligned, saved + j * sizeof(unsigned), sizeof(unsigned));
+ hw_half = (H5__Float16)(*((unsigned *)aligned));
+ break;
+ case INT_LONG:
+ memcpy(aligned, saved + j * sizeof(long), sizeof(long));
+ hw_half = (H5__Float16)(*((long *)aligned));
+ break;
+ case INT_ULONG:
+ memcpy(aligned, saved + j * sizeof(unsigned long), sizeof(unsigned long));
+ hw_half = (H5__Float16)(*((unsigned long *)aligned));
+ break;
+ case INT_LLONG:
+ memcpy(aligned, saved + j * sizeof(long long), sizeof(long long));
+ hw_half = (H5__Float16)(*((long long *)aligned));
+ break;
+ case INT_ULLONG:
+ memcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long));
+ hw_half = (H5__Float16)(*((unsigned long long *)aligned));
+ break;
+ case FLT_FLOAT16:
+ case FLT_FLOAT:
+ case FLT_DOUBLE:
+ case FLT_LDOUBLE:
+ case OTHER:
+ default:
+ assert(0 && "Unknown type");
+ break;
+ }
+#else
+ assert(0 && "Should not reach this point!");
+#endif
+ }
else if (INT_SCHAR == dst_type) {
hw = (unsigned char *)&hw_schar;
switch (src_type) {
@@ -3855,6 +4490,14 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
memcpy(aligned, saved + j * sizeof(long double), sizeof(long double));
hw_schar = (signed char)(*((long double *)aligned));
break;
+ case FLT_FLOAT16:
+#ifdef H5_HAVE__FLOAT16
+ memcpy(aligned, saved + j * sizeof(H5__Float16), sizeof(H5__Float16));
+ hw_schar = (signed char)(*((H5__Float16 *)aligned));
+ break;
+#else
+ assert(0 && "Should not reach this point!");
+#endif
case INT_SCHAR:
case INT_UCHAR:
case INT_SHORT:
@@ -3886,6 +4529,14 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
memcpy(aligned, saved + j * sizeof(long double), sizeof(long double));
hw_uchar = (unsigned char)(*((long double *)aligned));
break;
+ case FLT_FLOAT16:
+#ifdef H5_HAVE__FLOAT16
+ memcpy(aligned, saved + j * sizeof(H5__Float16), sizeof(H5__Float16));
+ hw_uchar = (unsigned char)(*((H5__Float16 *)aligned));
+ break;
+#else
+ assert(0 && "Should not reach this point!");
+#endif
case INT_SCHAR:
case INT_UCHAR:
case INT_SHORT:
@@ -3917,6 +4568,14 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
memcpy(aligned, saved + j * sizeof(long double), sizeof(long double));
hw_short = (short)(*((long double *)aligned));
break;
+ case FLT_FLOAT16:
+#ifdef H5_HAVE__FLOAT16
+ memcpy(aligned, saved + j * sizeof(H5__Float16), sizeof(H5__Float16));
+ hw_short = (short)(*((H5__Float16 *)aligned));
+ break;
+#else
+ assert(0 && "Should not reach this point!");
+#endif
case INT_SCHAR:
case INT_UCHAR:
case INT_SHORT:
@@ -3948,6 +4607,14 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
memcpy(aligned, saved + j * sizeof(long double), sizeof(long double));
hw_ushort = (unsigned short)(*((long double *)aligned));
break;
+ case FLT_FLOAT16:
+#ifdef H5_HAVE__FLOAT16
+ memcpy(aligned, saved + j * sizeof(H5__Float16), sizeof(H5__Float16));
+ hw_ushort = (unsigned short)(*((H5__Float16 *)aligned));
+ break;
+#else
+ assert(0 && "Should not reach this point!");
+#endif
case INT_SCHAR:
case INT_UCHAR:
case INT_SHORT:
@@ -3979,6 +4646,14 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
memcpy(aligned, saved + j * sizeof(long double), sizeof(long double));
hw_int = (int)(*((long double *)aligned));
break;
+ case FLT_FLOAT16:
+#ifdef H5_HAVE__FLOAT16
+ memcpy(aligned, saved + j * sizeof(H5__Float16), sizeof(H5__Float16));
+ hw_int = (int)(*((H5__Float16 *)aligned));
+ break;
+#else
+ assert(0 && "Should not reach this point!");
+#endif
case INT_SCHAR:
case INT_UCHAR:
case INT_SHORT:
@@ -4010,6 +4685,14 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
memcpy(aligned, saved + j * sizeof(long double), sizeof(long double));
hw_uint = (unsigned int)(*((long double *)aligned));
break;
+ case FLT_FLOAT16:
+#ifdef H5_HAVE__FLOAT16
+ memcpy(aligned, saved + j * sizeof(H5__Float16), sizeof(H5__Float16));
+ hw_uint = (unsigned int)(*((H5__Float16 *)aligned));
+ break;
+#else
+ assert(0 && "Should not reach this point!");
+#endif
case INT_SCHAR:
case INT_UCHAR:
case INT_SHORT:
@@ -4041,6 +4724,14 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
memcpy(aligned, saved + j * sizeof(long double), sizeof(long double));
hw_long = (long)(*((long double *)aligned));
break;
+ case FLT_FLOAT16:
+#ifdef H5_HAVE__FLOAT16
+ memcpy(aligned, saved + j * sizeof(H5__Float16), sizeof(H5__Float16));
+ hw_long = (long)(*((H5__Float16 *)aligned));
+ break;
+#else
+ assert(0 && "Should not reach this point!");
+#endif
case INT_SCHAR:
case INT_UCHAR:
case INT_SHORT:
@@ -4072,6 +4763,14 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
memcpy(aligned, saved + j * sizeof(long double), sizeof(long double));
hw_ulong = (unsigned long)(*((long double *)aligned));
break;
+ case FLT_FLOAT16:
+#ifdef H5_HAVE__FLOAT16
+ memcpy(aligned, saved + j * sizeof(H5__Float16), sizeof(H5__Float16));
+ hw_ulong = (unsigned long)(*((H5__Float16 *)aligned));
+ break;
+#else
+ assert(0 && "Should not reach this point!");
+#endif
case INT_SCHAR:
case INT_UCHAR:
case INT_SHORT:
@@ -4103,6 +4802,14 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
memcpy(aligned, saved + j * sizeof(long double), sizeof(long double));
hw_llong = (long long)(*((long double *)aligned));
break;
+ case FLT_FLOAT16:
+#ifdef H5_HAVE__FLOAT16
+ memcpy(aligned, saved + j * sizeof(H5__Float16), sizeof(H5__Float16));
+ hw_llong = (long long)(*((H5__Float16 *)aligned));
+ break;
+#else
+ assert(0 && "Should not reach this point!");
+#endif
case INT_SCHAR:
case INT_UCHAR:
case INT_SHORT:
@@ -4134,6 +4841,14 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
memcpy(aligned, saved + j * sizeof(long double), sizeof(long double));
hw_ullong = (unsigned long long)(*((long double *)aligned));
break;
+ case FLT_FLOAT16:
+#ifdef H5_HAVE__FLOAT16
+ memcpy(aligned, saved + j * sizeof(H5__Float16), sizeof(H5__Float16));
+ hw_ullong = (unsigned long long)(*((H5__Float16 *)aligned));
+ break;
+#else
+ assert(0 && "Should not reach this point!");
+#endif
case INT_SCHAR:
case INT_UCHAR:
case INT_SHORT:
@@ -4204,7 +4919,8 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
* Try to follow the except_func callback function to check if the
* desired value was set.
*/
- if ((FLT_FLOAT == src_type || FLT_DOUBLE == src_type || FLT_LDOUBLE == src_type) &&
+ if ((FLT_FLOAT == src_type || FLT_DOUBLE == src_type || FLT_LDOUBLE == src_type ||
+ FLT_FLOAT16 == src_type) &&
(INT_SCHAR == dst_type || INT_SHORT == dst_type || INT_INT == dst_type || INT_LONG == dst_type ||
INT_LLONG == dst_type)) {
if (0 == H5T__bit_get_d(src_bits, src_nbits - 1, (size_t)1) &&
@@ -4244,7 +4960,8 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
}
}
- if ((FLT_FLOAT == src_type || FLT_DOUBLE == src_type || FLT_LDOUBLE == src_type) &&
+ if ((FLT_FLOAT == src_type || FLT_DOUBLE == src_type || FLT_LDOUBLE == src_type ||
+ FLT_FLOAT16 == src_type) &&
(INT_UCHAR == dst_type || INT_USHORT == dst_type || INT_UINT == dst_type ||
INT_ULONG == dst_type || INT_ULLONG == dst_type)) {
if (H5T__bit_get_d(src_bits, src_nbits - 1, (size_t)1)) {
@@ -4347,6 +5064,14 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
memcpy(aligned, saved + j * sizeof(long double), sizeof(long double));
printf(" %29Lf\n", *((long double *)aligned));
break;
+ case FLT_FLOAT16:
+#ifdef H5_HAVE__FLOAT16
+ memcpy(aligned, saved + j * sizeof(H5__Float16), sizeof(H5__Float16));
+ printf(" %29f\n", (double)*((H5__Float16 *)aligned));
+ break;
+#else
+ assert(0 && "Should not reach this point!");
+#endif
case OTHER:
default:
assert(0 && "Unknown type");
@@ -4410,6 +5135,14 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
memcpy(aligned, buf + j * sizeof(long double), sizeof(long double));
printf(" %29Lf\n", *((long double *)aligned));
break;
+ case FLT_FLOAT16:
+#ifdef H5_HAVE__FLOAT16
+ memcpy(aligned, buf + j * sizeof(H5__Float16), sizeof(H5__Float16));
+ printf(" %29f\n", (double)*((H5__Float16 *)aligned));
+ break;
+#else
+ assert(0 && "Should not reach this point!");
+#endif
case OTHER:
default:
assert(0 && "Unknown type");
@@ -4460,6 +5193,13 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
case FLT_LDOUBLE:
printf(" %29Lf\n", *((long double *)((void *)hw)));
break;
+ case FLT_FLOAT16:
+#ifdef H5_HAVE__FLOAT16
+ printf(" %29f\n", (double)*((H5__Float16 *)((void *)hw)));
+ break;
+#else
+ assert(0 && "Should not reach this point!");
+#endif
case OTHER:
default:
assert(0 && "Unknown type");
@@ -4784,6 +5524,9 @@ run_fp_tests(const char *name)
nerrors += test_conv_flt_1("noop", TEST_NOOP, H5T_NATIVE_FLOAT, H5T_NATIVE_FLOAT);
nerrors += test_conv_flt_1("noop", TEST_NOOP, H5T_NATIVE_DOUBLE, H5T_NATIVE_DOUBLE);
nerrors += test_conv_flt_1("noop", TEST_NOOP, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LDOUBLE);
+#ifdef H5_HAVE__FLOAT16
+ nerrors += test_conv_flt_1("noop", TEST_NOOP, H5T_NATIVE_FLOAT16, H5T_NATIVE_FLOAT16);
+#endif
goto done;
}
@@ -4796,6 +5539,28 @@ run_fp_tests(const char *name)
nerrors += test_conv_flt_1(name, TEST_NORMAL, H5T_NATIVE_LDOUBLE, H5T_NATIVE_FLOAT);
nerrors += test_conv_flt_1(name, TEST_NORMAL, H5T_NATIVE_LDOUBLE, H5T_NATIVE_DOUBLE);
#endif
+#ifdef H5_HAVE__FLOAT16
+ nerrors += test_conv_flt_1(name, TEST_NORMAL, H5T_NATIVE_FLOAT16, H5T_NATIVE_FLOAT);
+ nerrors += test_conv_flt_1(name, TEST_NORMAL, H5T_NATIVE_FLOAT16, H5T_NATIVE_DOUBLE);
+ nerrors += test_conv_flt_1(name, TEST_NORMAL, H5T_NATIVE_FLOAT, H5T_NATIVE_FLOAT16);
+ nerrors += test_conv_flt_1(name, TEST_NORMAL, H5T_NATIVE_DOUBLE, H5T_NATIVE_FLOAT16);
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
+ nerrors += test_conv_flt_1(name, TEST_NORMAL, H5T_NATIVE_FLOAT16, H5T_NATIVE_LDOUBLE);
+#ifdef H5_LDOUBLE_TO_FLOAT16_CORRECT
+ nerrors += test_conv_flt_1(name, TEST_NORMAL, H5T_NATIVE_LDOUBLE, H5T_NATIVE_FLOAT16);
+#else
+ {
+ char str[256];
+
+ snprintf(str, sizeof(str), "Testing %s normalized %s -> %s conversions", name, "long double",
+ "_Float16");
+ printf("%-70s", str);
+ SKIPPED();
+ puts(" Test skipped due to compiler error in handling conversion.");
+ }
+#endif
+#endif
+#endif
/*Test denormalized values. TEST_DENORM indicates denormalized values.*/
nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_FLOAT, H5T_NATIVE_DOUBLE);
@@ -4819,6 +5584,28 @@ run_fp_tests(const char *name)
nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_LDOUBLE, H5T_NATIVE_DOUBLE);
#endif
+#ifdef H5_HAVE__FLOAT16
+ nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_FLOAT16, H5T_NATIVE_FLOAT);
+ nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_FLOAT16, H5T_NATIVE_DOUBLE);
+ nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_FLOAT, H5T_NATIVE_FLOAT16);
+ nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_DOUBLE, H5T_NATIVE_FLOAT16);
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
+ nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_FLOAT16, H5T_NATIVE_LDOUBLE);
+#ifdef H5_LDOUBLE_TO_FLOAT16_CORRECT
+ nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_LDOUBLE, H5T_NATIVE_FLOAT16);
+#else
+ {
+ char str[256];
+
+ snprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions", name, "long double",
+ "_Float16");
+ printf("%-70s", str);
+ SKIPPED();
+ puts(" Test skipped due to compiler error in handling conversion.");
+ }
+#endif
+#endif
+#endif
/*Test special values, +/-0, +/-infinity, +/-QNaN, +/-SNaN.*/
nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_FLOAT, H5T_NATIVE_DOUBLE);
@@ -4841,6 +5628,28 @@ run_fp_tests(const char *name)
}
#endif
#endif
+#ifdef H5_HAVE__FLOAT16
+ nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_FLOAT16, H5T_NATIVE_FLOAT);
+ nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_FLOAT16, H5T_NATIVE_DOUBLE);
+ nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_FLOAT, H5T_NATIVE_FLOAT16);
+ nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_DOUBLE, H5T_NATIVE_FLOAT16);
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
+ nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_FLOAT16, H5T_NATIVE_LDOUBLE);
+#ifdef H5_LDOUBLE_TO_FLOAT16_CORRECT
+ nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_LDOUBLE, H5T_NATIVE_FLOAT16);
+#else
+ {
+ char str[256];
+
+ snprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", name, "long double",
+ "_Float16");
+ printf("%-70s", str);
+ SKIPPED();
+ puts(" Test skipped due to compiler error in handling conversion.");
+ }
+#endif
+#endif
+#endif
done:
return nerrors;
@@ -4862,36 +5671,66 @@ run_int_fp_conv(const char *name)
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_SCHAR, H5T_NATIVE_FLOAT);
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_SCHAR, H5T_NATIVE_DOUBLE);
+#ifdef H5_HAVE__FLOAT16
+ nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_SCHAR, H5T_NATIVE_FLOAT16);
+#endif
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_UCHAR, H5T_NATIVE_FLOAT);
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_UCHAR, H5T_NATIVE_DOUBLE);
+#ifdef H5_HAVE__FLOAT16
+ nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_UCHAR, H5T_NATIVE_FLOAT16);
+#endif
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_SHORT, H5T_NATIVE_FLOAT);
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_SHORT, H5T_NATIVE_DOUBLE);
+#ifdef H5_HAVE__FLOAT16
+ nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_SHORT, H5T_NATIVE_FLOAT16);
+#endif
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_USHORT, H5T_NATIVE_FLOAT);
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_USHORT, H5T_NATIVE_DOUBLE);
+#ifdef H5_HAVE__FLOAT16
+ nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_USHORT, H5T_NATIVE_FLOAT16);
+#endif
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_INT, H5T_NATIVE_FLOAT);
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_INT, H5T_NATIVE_DOUBLE);
+#ifdef H5_HAVE__FLOAT16
+ nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_INT, H5T_NATIVE_FLOAT16);
+#endif
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_UINT, H5T_NATIVE_FLOAT);
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_UINT, H5T_NATIVE_DOUBLE);
+#ifdef H5_HAVE__FLOAT16
+ nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_UINT, H5T_NATIVE_FLOAT16);
+#endif
#if H5_SIZEOF_LONG != H5_SIZEOF_INT
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LONG, H5T_NATIVE_FLOAT);
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LONG, H5T_NATIVE_DOUBLE);
+#ifdef H5_HAVE__FLOAT16
+ nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LONG, H5T_NATIVE_FLOAT16);
+#endif
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULONG, H5T_NATIVE_FLOAT);
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULONG, H5T_NATIVE_DOUBLE);
+#ifdef H5_HAVE__FLOAT16
+ nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULONG, H5T_NATIVE_FLOAT16);
+#endif
#endif
#if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LLONG, H5T_NATIVE_FLOAT);
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LLONG, H5T_NATIVE_DOUBLE);
+#ifdef H5_HAVE__FLOAT16
+ nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LLONG, H5T_NATIVE_FLOAT16);
+#endif
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT);
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULLONG, H5T_NATIVE_DOUBLE);
+#ifdef H5_HAVE__FLOAT16
+ nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT16);
+#endif
#endif
#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
@@ -4967,41 +5806,74 @@ run_fp_int_conv(const char *name)
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_SCHAR);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_SCHAR);
+#ifdef H5_HAVE__FLOAT16
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT16, H5T_NATIVE_SCHAR);
+#endif
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_UCHAR);
+#ifdef H5_HAVE__FLOAT16
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT16, H5T_NATIVE_UCHAR);
+#endif
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_SHORT);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_SHORT);
+#ifdef H5_HAVE__FLOAT16
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT16, H5T_NATIVE_SHORT);
+#endif
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_USHORT);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_USHORT);
+#ifdef H5_HAVE__FLOAT16
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT16, H5T_NATIVE_USHORT);
+#endif
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_INT);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_INT);
+#ifdef H5_HAVE__FLOAT16
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT16, H5T_NATIVE_INT);
+#endif
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_UINT);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_UINT);
+#ifdef H5_HAVE__FLOAT16
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT16, H5T_NATIVE_UINT);
+#endif
#if H5_SIZEOF_LONG != H5_SIZEOF_INT
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_LONG);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_LONG);
+#ifdef H5_HAVE__FLOAT16
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT16, H5T_NATIVE_LONG);
+#endif
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_ULONG);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_ULONG);
+#ifdef H5_HAVE__FLOAT16
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT16, H5T_NATIVE_ULONG);
+#endif
#endif
#if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG
if (!strcmp(name, "hw")) { /* Hardware conversion */
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_LLONG);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_LLONG);
+#ifdef H5_HAVE__FLOAT16
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT16, H5T_NATIVE_LLONG);
+#endif
}
else { /* Software conversion */
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_LLONG);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_LLONG);
+#ifdef H5_HAVE__FLOAT16
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT16, H5T_NATIVE_LLONG);
+#endif
}
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_ULLONG);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_ULLONG);
+#ifdef H5_HAVE__FLOAT16
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT16, H5T_NATIVE_ULLONG);
+#endif
#endif
#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
diff --git a/test/dtypes.c b/test/dtypes.c
index 7aa3b17..7c170c0 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -73,8 +73,9 @@
} \
} while (0)
-static const char *FILENAME[] = {"dtypes0", "dtypes1", "dtypes2", "dtypes3", "dtypes4", "dtypes5",
- "dtypes6", "dtypes7", "dtypes8", "dtypes9", "dtypes10", NULL};
+static const char *FILENAME[] = {"dtypes0", "dtypes1", "dtypes2", "dtypes3", "dtypes4",
+ "dtypes5", "dtypes6", "dtypes7", "dtypes8", "dtypes9",
+ "dtypes10", "dtypes11", NULL};
#define TESTFILE "bad_compound.h5"
@@ -6037,6 +6038,424 @@ error:
}
/*-------------------------------------------------------------------------
+ * Function: test__Float16
+ *
+ * Purpose: Tests the _Float16 datatype.
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ *-------------------------------------------------------------------------
+ */
+static int
+test__Float16(void)
+{
+#ifdef H5_HAVE__FLOAT16
+ H5T_path_t *path = NULL;
+ hsize_t dims[1];
+ htri_t is_little_endian;
+ H5T_t *native_dtype = NULL;
+ H5T_t *tmp_dtype = NULL;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t space_id = H5I_INVALID_HID;
+ hid_t dset_id = H5I_INVALID_HID;
+ hid_t dcpl_id = H5I_INVALID_HID;
+ hid_t native_type = H5I_INVALID_HID;
+ char filename[256];
+
+ TESTING("_Float16 datatype");
+
+ /* Check that native macro maps to a valid type */
+ if (0 == H5Tget_size(H5T_NATIVE_FLOAT16)) {
+ H5_FAILED();
+ printf("Invalid size for H5T_NATIVE_FLOAT16 datatype\n");
+ goto error;
+ }
+
+ /* Check that native type for standard 16-bit float type matches */
+ if ((native_type = H5Tget_native_type(H5T_IEEE_F16LE, H5T_DIR_DEFAULT)) < 0) {
+ H5_FAILED();
+ printf("Can't get native type for H5T_IEEE_F16LE\n");
+ goto error;
+ }
+
+ if (0 == H5Tequal(native_type, H5T_NATIVE_FLOAT16)) {
+ H5_FAILED();
+ printf("Native _Float16 type for H5T_IEEE_F16LE wasn't equal to H5T_NATIVE_FLOAT16\n");
+ goto error;
+ }
+
+ if (H5Tclose(native_type) < 0) {
+ H5_FAILED();
+ printf("Can't close datatype\n");
+ goto error;
+ }
+
+ if ((native_type = H5Tget_native_type(H5T_IEEE_F16BE, H5T_DIR_DEFAULT)) < 0) {
+ H5_FAILED();
+ printf("Can't get native type for H5T_IEEE_F16BE\n");
+ goto error;
+ }
+
+ if (0 == H5Tequal(native_type, H5T_NATIVE_FLOAT16)) {
+ H5_FAILED();
+ printf("Native _Float16 type for H5T_IEEE_F16BE wasn't equal to H5T_NATIVE_FLOAT16\n");
+ goto error;
+ }
+
+ if (H5Tclose(native_type) < 0) {
+ H5_FAILED();
+ printf("Can't close datatype\n");
+ goto error;
+ }
+
+ /*
+ * Ensure that conversion between native _Float16 datatype and
+ * the matching standard datatype is covered by the no-op conversion
+ * function. Ensure that conversion between native _Float16 datatype
+ * and the other standard datatype is covered by the byte-order
+ * conversion function.
+ */
+ if (NULL == (native_dtype = H5I_object_verify(H5T_NATIVE_FLOAT16, H5I_DATATYPE))) {
+ H5_FAILED();
+ printf("Can't get H5T_t structure for datatype\n");
+ goto error;
+ }
+
+ if ((is_little_endian = H5Tequal(H5T_NATIVE_FLOAT16, H5T_IEEE_F16LE)) < 0) {
+ H5_FAILED();
+ printf("Can't check if native _Float16 type matches standard little-endian type\n");
+ goto error;
+ }
+
+ if (NULL == (tmp_dtype = H5I_object_verify(H5T_IEEE_F16LE, H5I_DATATYPE))) {
+ H5_FAILED();
+ printf("Can't get H5T_t structure for H5T_IEEE_F16LE datatype\n");
+ goto error;
+ }
+
+ if (NULL == (path = H5T_path_find(native_dtype, tmp_dtype))) {
+ H5_FAILED();
+ printf("Can't find datatype conversion path\n");
+ goto error;
+ }
+
+ if (path->is_hard || path->conv.is_app) {
+ H5_FAILED();
+ printf("Invalid conversion path for H5T_NATIVE_FLOAT16 -> H5T_IEEE_F16LE\n");
+ goto error;
+ }
+
+ if (is_little_endian) {
+ if (path->conv.u.lib_func != H5T__conv_noop) {
+ H5_FAILED();
+ printf("Conversion path for H5T_NATIVE_FLOAT16 -> H5T_IEEE_F16LE was not H5T__conv_noop\n");
+ goto error;
+ }
+ }
+ else {
+ if (path->conv.u.lib_func != H5T__conv_order_opt) {
+ H5_FAILED();
+ printf("Conversion path for H5T_NATIVE_FLOAT16 -> H5T_IEEE_F16LE was not H5T__conv_order\n");
+ goto error;
+ }
+ }
+
+ if (NULL == (tmp_dtype = H5I_object_verify(H5T_IEEE_F16BE, H5I_DATATYPE))) {
+ H5_FAILED();
+ printf("Can't get H5T_t structure for H5T_IEEE_F16BE datatype\n");
+ goto error;
+ }
+
+ if (NULL == (path = H5T_path_find(native_dtype, tmp_dtype))) {
+ H5_FAILED();
+ printf("Can't find datatype conversion path\n");
+ goto error;
+ }
+
+ if (path->is_hard || path->conv.is_app) {
+ H5_FAILED();
+ printf("Invalid conversion path for H5T_NATIVE_FLOAT16 -> H5T_IEEE_F16BE\n");
+ goto error;
+ }
+
+ if (is_little_endian) {
+ if (path->conv.u.lib_func != H5T__conv_order_opt) {
+ H5_FAILED();
+ printf("Conversion path for H5T_NATIVE_FLOAT16 -> H5T_IEEE_F16BE was not H5T__conv_order\n");
+ goto error;
+ }
+ }
+ else {
+ if (path->conv.u.lib_func != H5T__conv_noop) {
+ H5_FAILED();
+ printf("Conversion path for H5T_NATIVE_FLOAT16 -> H5T_IEEE_F16BE was not H5T__conv_noop\n");
+ goto error;
+ }
+ }
+
+ /*
+ * Ensure that conversion between native _Float16 datatype and a
+ * couple of other datatypes are the correct type of conversions.
+ */
+ if (is_little_endian) {
+ /* Check for a native type that matches H5T_STD_I32LE before
+ * checking for a hard conversion path
+ */
+ if (H5Tequal(H5T_NATIVE_SHORT, H5T_STD_I32LE) == true ||
+ H5Tequal(H5T_NATIVE_INT, H5T_STD_I32LE) == true ||
+ H5Tequal(H5T_NATIVE_LONG, H5T_STD_I32LE) == true) {
+ if (H5Tcompiler_conv(H5T_NATIVE_FLOAT16, H5T_STD_I32LE) != true) {
+ H5_FAILED();
+ printf("Conversion path for H5T_NATIVE_FLOAT16 -> H5T_STD_I32LE was not a hard conversion\n");
+ goto error;
+ }
+ }
+
+ if (H5Tcompiler_conv(H5T_NATIVE_FLOAT16, H5T_STD_I32BE) != false) {
+ H5_FAILED();
+ printf("Conversion path for H5T_NATIVE_FLOAT16 -> H5T_STD_I32BE was not a soft conversion\n");
+ goto error;
+ }
+ }
+ else {
+ if (H5Tcompiler_conv(H5T_NATIVE_FLOAT16, H5T_STD_I32LE) != false) {
+ H5_FAILED();
+ printf("Conversion path for H5T_NATIVE_FLOAT16 -> H5T_STD_I32LE was not a soft conversion\n");
+ goto error;
+ }
+
+ /* Check for a native type that matches H5T_STD_I32BE before
+ * checking for a hard conversion path
+ */
+ if (H5Tequal(H5T_NATIVE_SHORT, H5T_STD_I32BE) == true ||
+ H5Tequal(H5T_NATIVE_INT, H5T_STD_I32BE) == true ||
+ H5Tequal(H5T_NATIVE_LONG, H5T_STD_I32BE) == true) {
+ if (H5Tcompiler_conv(H5T_NATIVE_FLOAT16, H5T_STD_I32BE) != true) {
+ H5_FAILED();
+ printf("Conversion path for H5T_NATIVE_FLOAT16 -> H5T_STD_I32BE was not a hard conversion\n");
+ goto error;
+ }
+ }
+ }
+
+ if (H5Tcompiler_conv(H5T_NATIVE_FLOAT16, H5T_NATIVE_SCHAR) != true) {
+ H5_FAILED();
+ printf("Conversion path for H5T_NATIVE_FLOAT16 -> H5T_NATIVE_SCHAR was not a hard conversion\n");
+ goto error;
+ }
+
+ /*
+ * Ensure that conversion between standard _Float16 datatypes and a
+ * couple of other datatypes are the correct type of conversions.
+ */
+ if (is_little_endian) {
+ if (H5Tcompiler_conv(H5T_IEEE_F16LE, H5T_NATIVE_FLOAT) != true) {
+ H5_FAILED();
+ printf("Conversion path for H5T_IEEE_F16LE -> H5T_NATIVE_FLOAT was not a hard conversion\n");
+ goto error;
+ }
+
+ /* Check for a native type that matches H5T_IEEE_F32LE before
+ * checking for a hard conversion path
+ */
+ if (H5Tequal(H5T_NATIVE_FLOAT, H5T_IEEE_F32LE) == true ||
+ H5Tequal(H5T_NATIVE_DOUBLE, H5T_IEEE_F32LE) == true ||
+ H5Tequal(H5T_NATIVE_LDOUBLE, H5T_IEEE_F32LE) == true) {
+ if (H5Tcompiler_conv(H5T_IEEE_F16LE, H5T_IEEE_F32LE) != true) {
+ H5_FAILED();
+ printf("Conversion path for H5T_IEEE_F16LE -> H5T_IEEE_F32LE was not a hard conversion\n");
+ goto error;
+ }
+ }
+
+ if (H5Tcompiler_conv(H5T_IEEE_F16LE, H5T_IEEE_F32BE) != false) {
+ H5_FAILED();
+ printf("Conversion path for H5T_IEEE_F16LE -> H5T_IEEE_F32BE was not a soft conversion\n");
+ goto error;
+ }
+
+ if (H5Tcompiler_conv(H5T_IEEE_F16BE, H5T_NATIVE_FLOAT) != false) {
+ H5_FAILED();
+ printf("Conversion path for H5T_IEEE_F16BE -> H5T_NATIVE_FLOAT was not a soft conversion\n");
+ goto error;
+ }
+
+ if (H5Tcompiler_conv(H5T_IEEE_F16BE, H5T_IEEE_F32BE) != false) {
+ H5_FAILED();
+ printf("Conversion path for H5T_IEEE_F16BE -> H5T_IEEE_F32BE was not a soft conversion\n");
+ goto error;
+ }
+
+ if (H5Tcompiler_conv(H5T_IEEE_F16BE, H5T_IEEE_F32LE) != false) {
+ H5_FAILED();
+ printf("Conversion path for H5T_IEEE_F16BE -> H5T_IEEE_F32LE was not a soft conversion\n");
+ goto error;
+ }
+ }
+ else {
+ /* big-endian */
+ if (H5Tcompiler_conv(H5T_IEEE_F16LE, H5T_NATIVE_FLOAT) != false) {
+ H5_FAILED();
+ printf("Conversion path for H5T_IEEE_F16LE -> H5T_NATIVE_FLOAT was not a soft conversion\n");
+ goto error;
+ }
+
+ if (H5Tcompiler_conv(H5T_IEEE_F16LE, H5T_IEEE_F32LE) != false) {
+ H5_FAILED();
+ printf("Conversion path for H5T_IEEE_F16LE -> H5T_IEEE_F32LE was not a soft conversion\n");
+ goto error;
+ }
+
+ if (H5Tcompiler_conv(H5T_IEEE_F16LE, H5T_IEEE_F32BE) != false) {
+ H5_FAILED();
+ printf("Conversion path for H5T_IEEE_F16LE -> H5T_IEEE_F32BE was not a soft conversion\n");
+ goto error;
+ }
+
+ if (H5Tcompiler_conv(H5T_IEEE_F16BE, H5T_NATIVE_FLOAT) != true) {
+ H5_FAILED();
+ printf("Conversion path for H5T_IEEE_F16BE -> H5T_NATIVE_FLOAT was not a hard conversion\n");
+ goto error;
+ }
+
+ /* Check for a native type that matches H5T_IEEE_F32BE before
+ * checking for a hard conversion path
+ */
+ if (H5Tequal(H5T_NATIVE_FLOAT, H5T_IEEE_F32LE) == true ||
+ H5Tequal(H5T_NATIVE_DOUBLE, H5T_IEEE_F32LE) == true ||
+ H5Tequal(H5T_NATIVE_LDOUBLE, H5T_IEEE_F32LE) == true) {
+ if (H5Tcompiler_conv(H5T_IEEE_F16BE, H5T_IEEE_F32BE) != true) {
+ H5_FAILED();
+ printf("Conversion path for H5T_IEEE_F16BE -> H5T_IEEE_F32BE was not a hard conversion\n");
+ goto error;
+ }
+ }
+
+ if (H5Tcompiler_conv(H5T_IEEE_F16BE, H5T_IEEE_F32LE) != false) {
+ H5_FAILED();
+ printf("Conversion path for H5T_IEEE_F16BE -> H5T_IEEE_F32LE was not a soft conversion\n");
+ goto error;
+ }
+ }
+
+ /*
+ * Create a dataset with the datatype and check the dataset raw
+ * data storage size, as well as the file size
+ */
+ h5_fixname(FILENAME[11], H5P_DEFAULT, filename, sizeof filename);
+
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ H5_FAILED();
+ AT();
+ printf("Can't create file!\n");
+ goto error;
+ }
+
+ dims[0] = 10000;
+ if ((space_id = H5Screate_simple(1, dims, NULL)) < 0) {
+ H5_FAILED();
+ AT();
+ printf("Can't create dataspace\n");
+ goto error;
+ }
+
+ if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) {
+ H5_FAILED();
+ AT();
+ printf("Can't create DCPL\n");
+ goto error;
+ }
+
+ if (H5Pset_alloc_time(dcpl_id, H5D_ALLOC_TIME_EARLY) < 0) {
+ H5_FAILED();
+ AT();
+ printf("Can't set alloc time\n");
+ goto error;
+ }
+
+ if ((dset_id = H5Dcreate2(fid, "Dataset", H5T_NATIVE_FLOAT16, space_id, H5P_DEFAULT, dcpl_id,
+ H5P_DEFAULT)) < 0) {
+ H5_FAILED();
+ AT();
+ printf("Can't create dataset\n");
+ goto error;
+ }
+
+ if (H5Dget_storage_size(dset_id) != dims[0] * sizeof(H5__Float16)) {
+ H5_FAILED();
+ AT();
+ printf("Incorrect dataset raw data storage size allocated in file\n");
+ goto error;
+ }
+
+ if (H5Pclose(dcpl_id) < 0)
+ TEST_ERROR;
+ if (H5Sclose(space_id) < 0)
+ TEST_ERROR;
+ if (H5Dclose(dset_id) < 0)
+ TEST_ERROR;
+ if (H5Fclose(fid) < 0)
+ TEST_ERROR;
+
+ {
+ h5_stat_size_t file_size = h5_get_file_size(filename, H5P_DEFAULT);
+
+ if (file_size < 0)
+ TEST_ERROR;
+ if ((size_t)file_size < dims[0] * sizeof(H5__Float16)) {
+ H5_FAILED();
+ AT();
+ printf("File size value was too small\n");
+ goto error;
+ }
+
+ /* 4096 bytes is arbitrary, but should suffice for now */
+ if ((size_t)file_size > (dims[0] * sizeof(H5__Float16)) + 4096) {
+ H5_FAILED();
+ AT();
+ printf("File size value was too large\n");
+ goto error;
+ }
+ }
+
+ PASSED();
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY
+ {
+ H5Tclose(native_type);
+ H5Pclose(dcpl_id);
+ H5Sclose(space_id);
+ H5Dclose(dset_id);
+ H5Fclose(fid);
+ }
+ H5E_END_TRY
+
+ return 1;
+#else
+ TESTING("that _Float16 datatype is unavailable");
+
+ /* Make sure H5T_NATIVE_FLOAT16 macro maps to invalid datatype */
+ H5E_BEGIN_TRY
+ {
+ if (0 != H5Tget_size(H5T_NATIVE_FLOAT16)) {
+ H5_FAILED();
+ AT();
+ printf("Valid size was returned for invalid datatype\n");
+ return 1;
+ }
+ }
+ H5E_END_TRY
+
+ PASSED();
+
+ return 0;
+#endif
+}
+
+/*-------------------------------------------------------------------------
* Function: test_encode
*
* Purpose: Tests functions of encoding and decoding datatype.
@@ -9171,6 +9590,8 @@ main(void)
nerrors += test_opaque();
nerrors += test_set_order();
+ nerrors += test__Float16();
+
if (!driver_is_parallel) {
nerrors += test_utf_ascii_conv();
}
diff --git a/test/ntypes.c b/test/ntypes.c
index f36a600..5d6b371 100644
--- a/test/ntypes.c
+++ b/test/ntypes.c
@@ -40,6 +40,9 @@ static const char *FILENAME[] = {"ntypes", NULL};
#define DSET_OPAQUE_NAME "opaque_type"
#define DSET1_BITFIELD_NAME "bitfield_type_1"
#define DSET2_BITFIELD_NAME "bitfield_type_2"
+#ifdef H5_HAVE__FLOAT16
+#define DSET_FLOAT16_NAME "_Float16_type"
+#endif
#define SPACE1_DIM1 4
#define SPACE1_RANK 1
@@ -3051,6 +3054,120 @@ error:
return -1;
} /* end test_ninteger() */
+#ifdef H5_HAVE__FLOAT16
+static herr_t
+test__Float16(hid_t file)
+{
+ hsize_t dims[2];
+ hid_t dataset = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t dtype = H5I_INVALID_HID;
+ hid_t native_type = H5I_INVALID_HID;
+ struct {
+ H5__Float16 arr[DIM0][DIM1];
+ } *ipoints = NULL;
+ struct {
+ H5__Float16 arr[DIM0][DIM1];
+ } *icheck = NULL;
+
+ TESTING("_Float16 datatype");
+
+ if (NULL == (ipoints = calloc(1, sizeof(*ipoints))))
+ TEST_ERROR;
+ if (NULL == (icheck = calloc(1, sizeof(*icheck))))
+ TEST_ERROR;
+
+ /* Initialize the data */
+ for (size_t i = 0; i < DIM0; i++)
+ for (size_t j = 0; j < DIM1; j++)
+ ipoints->arr[i][j] = (H5__Float16)(HDrand() / (double)RAND_MAX);
+
+ /* Create the data space */
+ dims[0] = DIM0;
+ dims[1] = DIM1;
+ if ((space = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR;
+
+ if ((dataset = H5Dcreate2(file, DSET_FLOAT16_NAME, H5T_IEEE_F16BE, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ /* Write the data to the dataset */
+ if (H5Dwrite(dataset, H5T_NATIVE_FLOAT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints) < 0)
+ TEST_ERROR;
+
+ /* Close dataset */
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR;
+
+ /* Open dataset again to check H5Tget_native_type */
+ if ((dataset = H5Dopen2(file, DSET_FLOAT16_NAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ if ((dtype = H5Dget_type(dataset)) < 0)
+ TEST_ERROR;
+
+ if ((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ /* Verify the datatype retrieved and converted */
+ if (H5Tget_order(native_type) != H5Tget_order(H5T_NATIVE_FLOAT16))
+ TEST_ERROR;
+ if (H5Tget_size(native_type) != H5Tget_size(H5T_IEEE_F16BE))
+ TEST_ERROR;
+ if (H5T_FLOAT != H5Tget_class(native_type))
+ TEST_ERROR;
+
+ /* Read the dataset back */
+ if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, icheck) < 0)
+ TEST_ERROR;
+
+ /* Check that the values read are the same as the values written */
+ for (size_t i = 0; i < DIM0; i++)
+ for (size_t j = 0; j < DIM1; j++) {
+ if (!H5_FLT16_ABS_EQUAL(ipoints->arr[i][j], icheck->arr[i][j])) {
+ H5_FAILED();
+ printf(" Read different values than written.\n");
+ printf(" At index %zu,%zu\n", i, j);
+ goto error;
+ } /* end if */
+ }
+
+ if (H5Sclose(space) < 0)
+ TEST_ERROR;
+ if (H5Dclose(dataset) < 0)
+ TEST_ERROR;
+ if (H5Tclose(native_type) < 0)
+ TEST_ERROR;
+ if (H5Tclose(dtype) < 0)
+ TEST_ERROR;
+
+ free(ipoints);
+ ipoints = NULL;
+ free(icheck);
+ icheck = NULL;
+
+ PASSED();
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY
+ {
+ H5Dclose(dataset);
+ H5Tclose(native_type);
+ H5Tclose(dtype);
+ H5Sclose(space);
+ }
+ H5E_END_TRY
+
+ free(ipoints);
+ free(icheck);
+
+ return -1;
+}
+#endif
+
/*-------------------------------------------------------------------------
* Function: main
*
@@ -3101,6 +3218,10 @@ main(void)
nerrors += test_bitfield_dtype(file) < 0 ? 1 : 0;
nerrors += test_ninteger() < 0 ? 1 : 0;
+#ifdef H5_HAVE__FLOAT16
+ nerrors += test__Float16(file) < 0 ? 1 : 0;
+#endif
+
if (H5Fclose(file) < 0)
goto error;
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index d8c9ac6..dc658e3 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -145,6 +145,10 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi
diff_opt_t *opts);
static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
diff_opt_t *opts);
+#ifdef H5_HAVE__FLOAT16
+static hsize_t diff_float16_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
+ diff_opt_t *opts);
+#endif
static hsize_t diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
diff_opt_t *opts);
static hsize_t diff_uchar_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
@@ -233,7 +237,20 @@ diff_array(void *_mem1, void *_mem2, diff_opt_t *opts, hid_t container1_id, hid_
*/
case H5T_FLOAT:
H5TOOLS_DEBUG("type_class:H5T_FLOAT");
- if (H5Tequal(opts->m_tid, H5T_NATIVE_FLOAT)) {
+#ifdef H5_HAVE__FLOAT16
+ if (H5Tequal(opts->m_tid, H5T_NATIVE_FLOAT16)) {
+ for (i = 0; i < opts->hs_nelmts; i++) {
+ nfound += diff_float16_element(mem1, mem2, i, opts);
+
+ mem1 += sizeof(H5__Float16);
+ mem2 += sizeof(H5__Float16);
+ if (opts->count_bool && nfound >= opts->count)
+ return nfound;
+ }
+ }
+ else
+#endif
+ if (H5Tequal(opts->m_tid, H5T_NATIVE_FLOAT)) {
for (i = 0; i < opts->hs_nelmts; i++) {
nfound += diff_float_element(mem1, mem2, i, opts);
@@ -263,6 +280,7 @@ diff_array(void *_mem1, void *_mem2, diff_opt_t *opts, hid_t container1_id, hid_
return nfound;
} /* nelmts */
}
+
break;
case H5T_INTEGER:
@@ -1221,38 +1239,50 @@ diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t co
*-------------------------------------------------------------------------
*/
case H5T_FLOAT:
- /*-------------------------------------------------------------------------
- * H5T_NATIVE_FLOAT
- *-------------------------------------------------------------------------
- */
H5TOOLS_DEBUG("H5T_FLOAT");
- if (type_size == 4) {
- if (type_size != sizeof(float))
- H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not float size");
- nfound += diff_float_element(mem1, mem2, elemtno, opts);
- }
+#ifdef H5_HAVE__FLOAT16
/*-------------------------------------------------------------------------
- * H5T_NATIVE_DOUBLE
+ * H5T_NATIVE_FLOAT16
*-------------------------------------------------------------------------
*/
- else if (type_size == 8) {
- if (type_size != sizeof(double))
- H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not double size");
- nfound += diff_double_element(mem1, mem2, elemtno, opts);
+ if (type_size == H5_SIZEOF__FLOAT16) {
+ if (type_size != sizeof(H5__Float16))
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not _Float16 size");
+ nfound += diff_float16_element(mem1, mem2, elemtno, opts);
}
+ else
+#endif
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_FLOAT
+ *-------------------------------------------------------------------------
+ */
+ if (type_size == 4) {
+ if (type_size != sizeof(float))
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not float size");
+ nfound += diff_float_element(mem1, mem2, elemtno, opts);
+ }
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_DOUBLE
+ *-------------------------------------------------------------------------
+ */
+ else if (type_size == 8) {
+ if (type_size != sizeof(double))
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not double size");
+ nfound += diff_double_element(mem1, mem2, elemtno, opts);
+ }
#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
- /*-------------------------------------------------------------------------
- * H5T_NATIVE_LDOUBLE
- *-------------------------------------------------------------------------
- */
- else if (type_size == H5_SIZEOF_LONG_DOUBLE) {
- if (type_size != sizeof(long double)) {
- H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not long double size");
- }
- nfound += diff_ldouble_element(mem1, mem2, elemtno, opts);
- } /*H5T_NATIVE_LDOUBLE*/
-#endif /* H5_SIZEOF_LONG_DOUBLE */
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_LDOUBLE
+ *-------------------------------------------------------------------------
+ */
+ else if (type_size == H5_SIZEOF_LONG_DOUBLE) {
+ if (type_size != sizeof(long double)) {
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not long double size");
+ }
+ nfound += diff_ldouble_element(mem1, mem2, elemtno, opts);
+ } /*H5T_NATIVE_LDOUBLE*/
+#endif /* H5_SIZEOF_LONG_DOUBLE */
break; /* H5T_FLOAT class */
@@ -2178,6 +2208,189 @@ diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
return nfound;
}
+#ifdef H5_HAVE__FLOAT16
+/*-------------------------------------------------------------------------
+ * Function: diff_float16_element
+ *
+ * Purpose: diff a single H5T_NATIVE_FLOAT16 type
+ *
+ * Return: number of differences found
+ *
+ *-------------------------------------------------------------------------
+ */
+static hsize_t
+diff_float16_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
+{
+ hsize_t nfound = 0; /* number of differences found */
+ H5__Float16 temp1_float16;
+ H5__Float16 temp2_float16;
+ double per;
+ bool both_zero = false;
+ bool isnan1 = false;
+ bool isnan2 = false;
+
+ H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool);
+
+ memcpy(&temp1_float16, mem1, sizeof(H5__Float16));
+ memcpy(&temp2_float16, mem2, sizeof(H5__Float16));
+
+ /* logic for detecting NaNs is different with opts -d, -p and no opts */
+
+ /*-------------------------------------------------------------------------
+ * -d and !-p
+ *-------------------------------------------------------------------------
+ */
+ if (opts->delta_bool && !opts->percent_bool) {
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (opts->do_nans) {
+ isnan1 = isnan(temp1_float16);
+ isnan2 = isnan(temp2_float16);
+ }
+
+ /* both not NaN, do the comparison */
+ if (!isnan1 && !isnan2) {
+ if ((double)ABS(temp1_float16 - temp2_float16) > opts->delta) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(F_FORMAT, (double)temp1_float16, (double)temp2_float16,
+ (double)ABS(temp1_float16 - temp2_float16));
+ }
+ nfound++;
+ }
+ }
+ /* only one is NaN, assume difference */
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(F_FORMAT, (double)temp1_float16, (double)temp2_float16,
+ (double)ABS(temp1_float16 - temp2_float16));
+ }
+ nfound++;
+ }
+ }
+ /*-------------------------------------------------------------------------
+ * !-d and -p
+ *-------------------------------------------------------------------------
+ */
+ else if (!opts->delta_bool && opts->percent_bool) {
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (opts->do_nans) {
+ isnan1 = isnan(temp1_float16);
+ isnan2 = isnan(temp2_float16);
+ }
+ /* both not NaN, do the comparison */
+ if ((!isnan1 && !isnan2)) {
+ PER(temp1_float16, temp2_float16);
+
+ if (not_comparable && !both_zero) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(F_FORMAT_P_NOTCOMP, (double)temp1_float16, (double)temp2_float16,
+ (double)ABS(temp1_float16 - temp2_float16));
+ }
+ nfound++;
+ }
+ else if (per > opts->percent) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(F_FORMAT_P, (double)temp1_float16, (double)temp2_float16,
+ (double)ABS(temp1_float16 - temp2_float16),
+ (double)ABS(1 - temp2_float16 / temp1_float16));
+ }
+ nfound++;
+ }
+ }
+ /* only one is NaN, assume difference */
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(F_FORMAT, (double)temp1_float16, (double)temp2_float16,
+ (double)ABS(temp1_float16 - temp2_float16));
+ }
+ nfound++;
+ }
+ }
+ /*-------------------------------------------------------------------------
+ * -d and -p
+ *-------------------------------------------------------------------------
+ */
+ else if (opts->delta_bool && opts->percent_bool) {
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (opts->do_nans) {
+ isnan1 = isnan(temp1_float16);
+ isnan2 = isnan(temp2_float16);
+ }
+
+ /* both not NaN, do the comparison */
+ if (!isnan1 && !isnan2) {
+ PER(temp1_float16, temp2_float16);
+
+ if (not_comparable && !both_zero) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(F_FORMAT_P_NOTCOMP, (double)temp1_float16, (double)temp2_float16,
+ (double)ABS(temp1_float16 - temp2_float16));
+ }
+ nfound++;
+ }
+ else if (per > opts->percent && (double)ABS(temp1_float16 - temp2_float16) > opts->delta) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(F_FORMAT_P, (double)temp1_float16, (double)temp2_float16,
+ (double)ABS(temp1_float16 - temp2_float16),
+ (double)ABS(1 - temp2_float16 / temp1_float16));
+ }
+ nfound++;
+ }
+ }
+ /* only one is NaN, assume difference */
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(F_FORMAT, (double)temp1_float16, (double)temp2_float16,
+ (double)ABS(temp1_float16 - temp2_float16));
+ }
+ nfound++;
+ }
+ }
+ /*-------------------------------------------------------------------------
+ * no -d and -p
+ *-------------------------------------------------------------------------
+ */
+ else {
+ if (equal_float((float)temp1_float16, (float)temp2_float16, opts) == false) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(F_FORMAT, (double)temp1_float16, (double)temp2_float16,
+ (double)ABS(temp1_float16 - temp2_float16));
+ }
+ nfound++;
+ }
+ }
+
+ H5TOOLS_ENDDEBUG(": %" PRIuHSIZE " zero:%d", nfound, both_zero);
+ return nfound;
+}
+#endif
+
/*-------------------------------------------------------------------------
* Function: diff_schar_element
*
diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c
index 4641c93..26cde1b 100644
--- a/tools/lib/h5diff_util.c
+++ b/tools/lib/h5diff_util.c
@@ -120,7 +120,11 @@ print_type(hid_t type)
break;
case H5T_FLOAT:
- if (H5Tequal(type, H5T_IEEE_F32BE))
+ if (H5Tequal(type, H5T_IEEE_F16BE))
+ parallel_print("H5T_IEEE_F16BE");
+ else if (H5Tequal(type, H5T_IEEE_F16LE))
+ parallel_print("H5T_IEEE_F16LE");
+ else if (H5Tequal(type, H5T_IEEE_F32BE))
parallel_print("H5T_IEEE_F32BE");
else if (H5Tequal(type, H5T_IEEE_F32LE))
parallel_print("H5T_IEEE_F32LE");
@@ -128,6 +132,10 @@ print_type(hid_t type)
parallel_print("H5T_IEEE_F64BE");
else if (H5Tequal(type, H5T_IEEE_F64LE))
parallel_print("H5T_IEEE_F64LE");
+#ifdef H5_HAVE__FLOAT16
+ else if (H5Tequal(type, H5T_NATIVE_FLOAT16))
+ parallel_print("H5T_NATIVE_FLOAT16");
+#endif
else if (H5Tequal(type, H5T_NATIVE_FLOAT))
parallel_print("H5T_NATIVE_FLOAT");
else if (H5Tequal(type, H5T_NATIVE_DOUBLE))
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index efaddee..5a8c401 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -2190,7 +2190,11 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
break;
case H5T_FLOAT:
- if (H5Tequal(type, H5T_IEEE_F32BE) == true)
+ if (H5Tequal(type, H5T_IEEE_F16BE) == true)
+ h5tools_str_append(buffer, "H5T_IEEE_F16BE");
+ else if (H5Tequal(type, H5T_IEEE_F16LE) == true)
+ h5tools_str_append(buffer, "H5T_IEEE_F16LE");
+ else if (H5Tequal(type, H5T_IEEE_F32BE) == true)
h5tools_str_append(buffer, "H5T_IEEE_F32BE");
else if (H5Tequal(type, H5T_IEEE_F32LE) == true)
h5tools_str_append(buffer, "H5T_IEEE_F32LE");
@@ -2202,6 +2206,10 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
h5tools_str_append(buffer, "H5T_VAX_F32");
else if (H5Tequal(type, H5T_VAX_F64) == true)
h5tools_str_append(buffer, "H5T_VAX_F64");
+#ifdef H5_HAVE__FLOAT16
+ else if (H5Tequal(type, H5T_NATIVE_FLOAT16) == true)
+ h5tools_str_append(buffer, "H5T_NATIVE_FLOAT16");
+#endif
else if (H5Tequal(type, H5T_NATIVE_FLOAT) == true)
h5tools_str_append(buffer, "H5T_NATIVE_FLOAT");
else if (H5Tequal(type, H5T_NATIVE_DOUBLE) == true)
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 5ef86fb..47893ec 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -700,7 +700,17 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
switch (type_class) {
case H5T_FLOAT:
H5TOOLS_DEBUG("H5T_FLOAT");
- if (sizeof(float) == nsize) {
+#ifdef H5_HAVE__FLOAT16
+ if (sizeof(H5__Float16) == nsize) {
+ /* if (H5Tequal(type, H5T_NATIVE_FLOAT16)) */
+ H5__Float16 tempfloat16;
+
+ memcpy(&tempfloat16, vp, sizeof(H5__Float16));
+ h5tools_str_append(str, OPT(info->fmt_float, "%g"), (double)tempfloat16);
+ }
+ else
+#endif
+ if (sizeof(float) == nsize) {
/* if (H5Tequal(type, H5T_NATIVE_FLOAT)) */
float tempfloat;
diff --git a/tools/lib/h5tools_type.c b/tools/lib/h5tools_type.c
index 7e9f6f7..c5e7472 100644
--- a/tools/lib/h5tools_type.c
+++ b/tools/lib/h5tools_type.c
@@ -55,7 +55,9 @@ h5tools_get_little_endian_type(hid_t tid)
break;
case H5T_FLOAT:
- if (size == 4)
+ if (size == 2)
+ p_type = H5Tcopy(H5T_IEEE_F16LE);
+ else if (size == 4)
p_type = H5Tcopy(H5T_IEEE_F32LE);
else if (size == 8)
p_type = H5Tcopy(H5T_IEEE_F64LE);
@@ -134,7 +136,9 @@ h5tools_get_big_endian_type(hid_t tid)
break;
case H5T_FLOAT:
- if (size == 4)
+ if (size == 2)
+ p_type = H5Tcopy(H5T_IEEE_F16BE);
+ else if (size == 4)
p_type = H5Tcopy(H5T_IEEE_F32BE);
else if (size == 8)
p_type = H5Tcopy(H5T_IEEE_F64BE);
diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c
index 828cb6a..fd90584 100644
--- a/tools/src/h5import/h5import.c
+++ b/tools/src/h5import/h5import.c
@@ -3114,6 +3114,48 @@ getInputClassType(struct Input *in, char *buffer)
kindex = 7;
}
+ else if (!strcmp(buffer, "H5T_IEEE_F16BE")) {
+ in->inputSize = 16;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("IEEE")) == -1) {
+ (void)fprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void)fprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+#ifdef H5DEBUGIMPORT
+ printf("h5dump inputByteOrder %d\n", in->inputByteOrder);
+#endif
+
+ kindex = 3;
+ }
+ else if (!strcmp(buffer, "H5T_IEEE_F16LE")) {
+ in->inputSize = 16;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("IEEE")) == -1) {
+ (void)fprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void)fprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+#ifdef H5DEBUGIMPORT
+ printf("h5dump inputByteOrder %d\n", in->inputByteOrder);
+#endif
+
+ kindex = 3;
+ }
else if (!strcmp(buffer, "H5T_IEEE_F32BE")) {
in->inputSize = 32;
in->configOptionVector[INPUT_SIZE] = 1;
@@ -3210,6 +3252,20 @@ getInputClassType(struct Input *in, char *buffer)
kindex = 3;
}
+#ifdef H5_HAVE__FLOAT16
+ else if (!strcmp(buffer, "H5T_NATIVE_FLOAT16")) {
+ in->inputSize = 16;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
+ (void)fprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ kindex = 3;
+ }
+#endif
else if (!strcmp(buffer, "H5T_NATIVE_FLOAT")) {
in->inputSize = 32;
in->configOptionVector[INPUT_SIZE] = 1;
@@ -3936,6 +3992,12 @@ createOutputDataType(struct Input *in)
switch (in->outputArchitecture) {
case 0:
switch (in->outputSize) {
+#ifdef H5_HAVE__FLOAT16
+ case 16:
+ new_type = H5Tcopy(H5T_NATIVE_FLOAT16);
+ break;
+#endif
+
case 32:
new_type = H5Tcopy(H5T_NATIVE_FLOAT);
break;
@@ -3971,6 +4033,23 @@ createOutputDataType(struct Input *in)
case 2:
switch (in->outputSize) {
+ case 16:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_IEEE_F16BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_IEEE_F16LE);
+ break;
+
+ default:
+ (void)fprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
case 32:
switch (in->outputByteOrder) {
case -1:
@@ -4291,6 +4370,12 @@ createInputDataType(struct Input *in)
switch (in->inputArchitecture) {
case 0:
switch (in->inputSize) {
+#ifdef H5_HAVE__FLOAT16
+ case 16:
+ new_type = H5Tcopy(H5T_NATIVE_FLOAT16);
+ break;
+#endif
+
case 32:
new_type = H5Tcopy(H5T_NATIVE_FLOAT);
break;
@@ -4326,6 +4411,23 @@ createInputDataType(struct Input *in)
case 2:
switch (in->inputSize) {
+ case 16:
+ switch (in->inputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_IEEE_F16BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_IEEE_F16LE);
+ break;
+
+ default:
+ (void)fprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
case 32:
switch (in->inputByteOrder) {
case -1:
@@ -4535,6 +4637,12 @@ createInputDataType(struct Input *in)
case 2:
case 3:
switch (in->inputSize) {
+#ifdef H5_HAVE__FLOAT16
+ case 16:
+ new_type = H5Tcopy(H5T_NATIVE_FLOAT16);
+ break;
+#endif
+
case 32:
new_type = H5Tcopy(H5T_NATIVE_FLOAT);
break;
diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c
index b3488d5..a5c1aa5 100644
--- a/tools/src/h5ls/h5ls.c
+++ b/tools/src/h5ls/h5ls.c
@@ -427,6 +427,11 @@ print_native_type(h5tools_str_t *buffer, hid_t type, int ind)
else if (H5Tequal(type, H5T_NATIVE_ULLONG) == true) {
h5tools_str_append(buffer, "native unsigned long long");
}
+#ifdef H5_HAVE__FLOAT16
+ else if (H5Tequal(type, H5T_NATIVE_FLOAT16) == true) {
+ h5tools_str_append(buffer, "native _Float16");
+ }
+#endif
else if (H5Tequal(type, H5T_NATIVE_FLOAT) == true) {
h5tools_str_append(buffer, "native float");
}
@@ -551,7 +556,13 @@ print_native_type(h5tools_str_t *buffer, hid_t type, int ind)
static bool
print_ieee_type(h5tools_str_t *buffer, hid_t type, int ind)
{
- if (H5Tequal(type, H5T_IEEE_F32BE) == true) {
+ if (H5Tequal(type, H5T_IEEE_F16BE) == true) {
+ h5tools_str_append(buffer, "IEEE 16-bit big-endian float");
+ }
+ else if (H5Tequal(type, H5T_IEEE_F16LE) == true) {
+ h5tools_str_append(buffer, "IEEE 16-bit little-endian float");
+ }
+ else if (H5Tequal(type, H5T_IEEE_F32BE) == true) {
h5tools_str_append(buffer, "IEEE 32-bit big-endian float");
}
else if (H5Tequal(type, H5T_IEEE_F32LE) == true) {
diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake
index 586957e..3a863bd 100644
--- a/tools/test/h5dump/CMakeTests.cmake
+++ b/tools/test/h5dump/CMakeTests.cmake
@@ -103,6 +103,8 @@
tfletcher32.ddl
#tfloatsattrs.ddl #native
#tfloatsattrs.wddl #special for windows
+ tfloat16.ddl
+ tfloat16_be.ddl
tfpformat.ddl
tgroup-1.ddl
tgroup-2.ddl
@@ -291,6 +293,8 @@
tfcontents2.h5
tfilters.h5
tfloatsattrs.h5
+ tfloat16.h5
+ tfloat16_be.h5
tfpformat.h5
tfvalues.h5
tgroup.h5
@@ -1336,6 +1340,10 @@
ADD_H5_TEST (tldouble 0 --enable-error-stack tldouble.h5)
ADD_H5_TEST (tldouble_scalar 0 -p --enable-error-stack tldouble_scalar.h5)
+ # Add tests for _Float16 type
+ ADD_H5_TEST (tfloat16 0 --enable-error-stack tfloat16.h5)
+ ADD_H5_TEST (tfloat16_be 0 --enable-error-stack tfloat16_be.h5)
+
# test for vms
ADD_H5_TEST (tvms 0 --enable-error-stack tvms.h5)
diff --git a/tools/test/h5dump/CMakeTestsXML.cmake b/tools/test/h5dump/CMakeTestsXML.cmake
index b322d76..5d2e647 100644
--- a/tools/test/h5dump/CMakeTestsXML.cmake
+++ b/tools/test/h5dump/CMakeTestsXML.cmake
@@ -57,6 +57,8 @@
tdset.h5
tempty.h5
textlink.h5
+ tfloat16.h5
+ tfloat16_be.h5
tfpformat.h5
tgroup.h5
thlink.h5
@@ -106,6 +108,8 @@
tenum.h5.xml
test35.nc.xml
textlink.h5.xml
+ tfloat16.h5.xml
+ tfloat16_be.h5.xml
tfpformat.h5.xml
tgroup.h5.xml
thlink.h5.xml
@@ -294,6 +298,10 @@
ADD_XML_H5_TEST (torderattr3.h5 0 -H --sort_by=creation_order --sort_order=ascending torderattr.h5)
ADD_XML_H5_TEST (torderattr4.h5 0 -H --sort_by=creation_order --sort_order=descending torderattr.h5)
+ # Add tests for _Float16 type
+ ADD_XML_H5_TEST (tfloat16.h5 0 tfloat16.h5)
+ ADD_XML_H5_TEST (tfloat16_be.h5 0 tfloat16_be.h5)
+
# tests for floating point user defined printf format
ADD_XML_H5_TEST (tfpformat.h5 0 -u -m %.7f tfpformat.h5)
diff --git a/tools/test/h5dump/expected/tfloat16.ddl b/tools/test/h5dump/expected/tfloat16.ddl
new file mode 100644
index 0000000..a98200c
--- /dev/null
+++ b/tools/test/h5dump/expected/tfloat16.ddl
@@ -0,0 +1,46 @@
+HDF5 "tfloat16.h5" {
+GROUP "/" {
+ DATASET "DS16BITS" {
+ DATATYPE H5T_IEEE_F16LE
+ DATASPACE SIMPLE { ( 8, 16 ) / ( 8, 16 ) }
+ DATA {
+ (0,0): 16, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7, 7.5,
+ (1,0): 15, 0.5625, 1.0625, 1.5625, 2.0625, 2.5625, 3.0625, 3.5625,
+ (1,8): 4.0625, 4.5625, 5.0625, 5.5625, 6.0625, 6.5625, 7.0625, 7.5625,
+ (2,0): 14, 0.625, 1.125, 1.625, 2.125, 2.625, 3.125, 3.625, 4.125,
+ (2,9): 4.625, 5.125, 5.625, 6.125, 6.625, 7.125, 7.625,
+ (3,0): 13, 0.6875, 1.1875, 1.6875, 2.1875, 2.6875, 3.1875, 3.6875,
+ (3,8): 4.1875, 4.6875, 5.1875, 5.6875, 6.1875, 6.6875, 7.1875, 7.6875,
+ (4,0): 12, 0.75, 1.25, 1.75, 2.25, 2.75, 3.25, 3.75, 4.25, 4.75, 5.25,
+ (4,11): 5.75, 6.25, 6.75, 7.25, 7.75,
+ (5,0): 11, 0.8125, 1.3125, 1.8125, 2.3125, 2.8125, 3.3125, 3.8125,
+ (5,8): 4.3125, 4.8125, 5.3125, 5.8125, 6.3125, 6.8125, 7.3125, 7.8125,
+ (6,0): 10, 0.875, 1.375, 1.875, 2.375, 2.875, 3.375, 3.875, 4.375,
+ (6,9): 4.875, 5.375, 5.875, 6.375, 6.875, 7.375, 7.875,
+ (7,0): 9, 0.9375, 1.4375, 1.9375, 2.4375, 2.9375, 3.4375, 3.9375,
+ (7,8): 4.4375, 4.9375, 5.4375, 5.9375, 6.4375, 6.9375, 7.4375, 7.9375
+ }
+ ATTRIBUTE "DS16BITS" {
+ DATATYPE H5T_IEEE_F16LE
+ DATASPACE SIMPLE { ( 128 ) / ( 128 ) }
+ DATA {
+ (0): 16, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7,
+ (15): 7.5, 15, 0.5625, 1.0625, 1.5625, 2.0625, 2.5625, 3.0625,
+ (23): 3.5625, 4.0625, 4.5625, 5.0625, 5.5625, 6.0625, 6.5625,
+ (30): 7.0625, 7.5625, 14, 0.625, 1.125, 1.625, 2.125, 2.625, 3.125,
+ (39): 3.625, 4.125, 4.625, 5.125, 5.625, 6.125, 6.625, 7.125, 7.625,
+ (48): 13, 0.6875, 1.1875, 1.6875, 2.1875, 2.6875, 3.1875, 3.6875,
+ (56): 4.1875, 4.6875, 5.1875, 5.6875, 6.1875, 6.6875, 7.1875,
+ (63): 7.6875, 12, 0.75, 1.25, 1.75, 2.25, 2.75, 3.25, 3.75, 4.25,
+ (73): 4.75, 5.25, 5.75, 6.25, 6.75, 7.25, 7.75, 11, 0.8125, 1.3125,
+ (83): 1.8125, 2.3125, 2.8125, 3.3125, 3.8125, 4.3125, 4.8125,
+ (90): 5.3125, 5.8125, 6.3125, 6.8125, 7.3125, 7.8125, 10, 0.875,
+ (98): 1.375, 1.875, 2.375, 2.875, 3.375, 3.875, 4.375, 4.875, 5.375,
+ (107): 5.875, 6.375, 6.875, 7.375, 7.875, 9, 0.9375, 1.4375, 1.9375,
+ (116): 2.4375, 2.9375, 3.4375, 3.9375, 4.4375, 4.9375, 5.4375,
+ (123): 5.9375, 6.4375, 6.9375, 7.4375, 7.9375
+ }
+ }
+ }
+}
+}
diff --git a/tools/test/h5dump/expected/tfloat16_be.ddl b/tools/test/h5dump/expected/tfloat16_be.ddl
new file mode 100644
index 0000000..0872a92
--- /dev/null
+++ b/tools/test/h5dump/expected/tfloat16_be.ddl
@@ -0,0 +1,46 @@
+HDF5 "tfloat16_be.h5" {
+GROUP "/" {
+ DATASET "DS16BITS" {
+ DATATYPE H5T_IEEE_F16BE
+ DATASPACE SIMPLE { ( 8, 16 ) / ( 8, 16 ) }
+ DATA {
+ (0,0): 16, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7, 7.5,
+ (1,0): 15, 0.5625, 1.0625, 1.5625, 2.0625, 2.5625, 3.0625, 3.5625,
+ (1,8): 4.0625, 4.5625, 5.0625, 5.5625, 6.0625, 6.5625, 7.0625, 7.5625,
+ (2,0): 14, 0.625, 1.125, 1.625, 2.125, 2.625, 3.125, 3.625, 4.125,
+ (2,9): 4.625, 5.125, 5.625, 6.125, 6.625, 7.125, 7.625,
+ (3,0): 13, 0.6875, 1.1875, 1.6875, 2.1875, 2.6875, 3.1875, 3.6875,
+ (3,8): 4.1875, 4.6875, 5.1875, 5.6875, 6.1875, 6.6875, 7.1875, 7.6875,
+ (4,0): 12, 0.75, 1.25, 1.75, 2.25, 2.75, 3.25, 3.75, 4.25, 4.75, 5.25,
+ (4,11): 5.75, 6.25, 6.75, 7.25, 7.75,
+ (5,0): 11, 0.8125, 1.3125, 1.8125, 2.3125, 2.8125, 3.3125, 3.8125,
+ (5,8): 4.3125, 4.8125, 5.3125, 5.8125, 6.3125, 6.8125, 7.3125, 7.8125,
+ (6,0): 10, 0.875, 1.375, 1.875, 2.375, 2.875, 3.375, 3.875, 4.375,
+ (6,9): 4.875, 5.375, 5.875, 6.375, 6.875, 7.375, 7.875,
+ (7,0): 9, 0.9375, 1.4375, 1.9375, 2.4375, 2.9375, 3.4375, 3.9375,
+ (7,8): 4.4375, 4.9375, 5.4375, 5.9375, 6.4375, 6.9375, 7.4375, 7.9375
+ }
+ ATTRIBUTE "DS16BITS" {
+ DATATYPE H5T_IEEE_F16BE
+ DATASPACE SIMPLE { ( 128 ) / ( 128 ) }
+ DATA {
+ (0): 16, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7,
+ (15): 7.5, 15, 0.5625, 1.0625, 1.5625, 2.0625, 2.5625, 3.0625,
+ (23): 3.5625, 4.0625, 4.5625, 5.0625, 5.5625, 6.0625, 6.5625,
+ (30): 7.0625, 7.5625, 14, 0.625, 1.125, 1.625, 2.125, 2.625, 3.125,
+ (39): 3.625, 4.125, 4.625, 5.125, 5.625, 6.125, 6.625, 7.125, 7.625,
+ (48): 13, 0.6875, 1.1875, 1.6875, 2.1875, 2.6875, 3.1875, 3.6875,
+ (56): 4.1875, 4.6875, 5.1875, 5.6875, 6.1875, 6.6875, 7.1875,
+ (63): 7.6875, 12, 0.75, 1.25, 1.75, 2.25, 2.75, 3.25, 3.75, 4.25,
+ (73): 4.75, 5.25, 5.75, 6.25, 6.75, 7.25, 7.75, 11, 0.8125, 1.3125,
+ (83): 1.8125, 2.3125, 2.8125, 3.3125, 3.8125, 4.3125, 4.8125,
+ (90): 5.3125, 5.8125, 6.3125, 6.8125, 7.3125, 7.8125, 10, 0.875,
+ (98): 1.375, 1.875, 2.375, 2.875, 3.375, 3.875, 4.375, 4.875, 5.375,
+ (107): 5.875, 6.375, 6.875, 7.375, 7.875, 9, 0.9375, 1.4375, 1.9375,
+ (116): 2.4375, 2.9375, 3.4375, 3.9375, 4.4375, 4.9375, 5.4375,
+ (123): 5.9375, 6.4375, 6.9375, 7.4375, 7.9375
+ }
+ }
+ }
+}
+}
diff --git a/tools/test/h5dump/expected/xml/tfloat16.h5.xml b/tools/test/h5dump/expected/xml/tfloat16.h5.xml
new file mode 100644
index 0000000..6b2c041
--- /dev/null
+++ b/tools/test/h5dump/expected/xml/tfloat16.h5.xml
@@ -0,0 +1,302 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/HDF5/XML/schema/HDF5-File http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd">
+<hdf5:RootGroup OBJ-XID="xid_96" H5Path="/">
+ <hdf5:Dataset Name="DS16BITS" OBJ-XID="xid_800" H5Path= "/DS16BITS" Parents="xid_96" H5ParentPaths="/">
+ <hdf5:StorageLayout>
+ <hdf5:ContiguousLayout/>
+ </hdf5:StorageLayout>
+ <hdf5:FillValueInfo FillTime="FillIfSet" AllocationTime="Late">
+ <hdf5:FillValue>
+ <hdf5:NoFill/>
+ </hdf5:FillValue>
+ </hdf5:FillValueInfo>
+ <hdf5:Dataspace>
+ <hdf5:SimpleDataspace Ndims="2">
+ <hdf5:Dimension DimSize="8" MaxDimSize="8"/>
+ <hdf5:Dimension DimSize="16" MaxDimSize="16"/>
+ </hdf5:SimpleDataspace>
+ </hdf5:Dataspace>
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:FloatType ByteOrder="LE" Size="2" SignBitLocation="15" ExponentBits="5" ExponentLocation="10" MantissaBits="10" MantissaLocation="0" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ <hdf5:Attribute Name="DS16BITS">
+ <hdf5:Dataspace>
+ <hdf5:SimpleDataspace Ndims="1">
+ <hdf5:Dimension DimSize="128" MaxDimSize="128"/>
+ </hdf5:SimpleDataspace>
+ </hdf5:Dataspace>
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:FloatType ByteOrder="LE" Size="2" SignBitLocation="15" ExponentBits="5" ExponentLocation="10" MantissaBits="10" MantissaLocation="0" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ <hdf5:Data>
+ <hdf5:DataFromFile>
+ 16
+ 0.5
+ 1
+ 1.5
+ 2
+ 2.5
+ 3
+ 3.5
+ 4
+ 4.5
+ 5
+ 5.5
+ 6
+ 6.5
+ 7
+ 7.5
+ 15
+ 0.5625
+ 1.0625
+ 1.5625
+ 2.0625
+ 2.5625
+ 3.0625
+ 3.5625
+ 4.0625
+ 4.5625
+ 5.0625
+ 5.5625
+ 6.0625
+ 6.5625
+ 7.0625
+ 7.5625
+ 14
+ 0.625
+ 1.125
+ 1.625
+ 2.125
+ 2.625
+ 3.125
+ 3.625
+ 4.125
+ 4.625
+ 5.125
+ 5.625
+ 6.125
+ 6.625
+ 7.125
+ 7.625
+ 13
+ 0.6875
+ 1.1875
+ 1.6875
+ 2.1875
+ 2.6875
+ 3.1875
+ 3.6875
+ 4.1875
+ 4.6875
+ 5.1875
+ 5.6875
+ 6.1875
+ 6.6875
+ 7.1875
+ 7.6875
+ 12
+ 0.75
+ 1.25
+ 1.75
+ 2.25
+ 2.75
+ 3.25
+ 3.75
+ 4.25
+ 4.75
+ 5.25
+ 5.75
+ 6.25
+ 6.75
+ 7.25
+ 7.75
+ 11
+ 0.8125
+ 1.3125
+ 1.8125
+ 2.3125
+ 2.8125
+ 3.3125
+ 3.8125
+ 4.3125
+ 4.8125
+ 5.3125
+ 5.8125
+ 6.3125
+ 6.8125
+ 7.3125
+ 7.8125
+ 10
+ 0.875
+ 1.375
+ 1.875
+ 2.375
+ 2.875
+ 3.375
+ 3.875
+ 4.375
+ 4.875
+ 5.375
+ 5.875
+ 6.375
+ 6.875
+ 7.375
+ 7.875
+ 9
+ 0.9375
+ 1.4375
+ 1.9375
+ 2.4375
+ 2.9375
+ 3.4375
+ 3.9375
+ 4.4375
+ 4.9375
+ 5.4375
+ 5.9375
+ 6.4375
+ 6.9375
+ 7.4375
+ 7.9375
+ </hdf5:DataFromFile>
+ </hdf5:Data>
+ </hdf5:Attribute>
+ <hdf5:Data>
+ <hdf5:DataFromFile>
+ 16
+ 0.5
+ 1
+ 1.5
+ 2
+ 2.5
+ 3
+ 3.5
+ 4
+ 4.5
+ 5
+ 5.5
+ 6
+ 6.5
+ 7
+ 7.5
+ 15
+ 0.5625
+ 1.0625
+ 1.5625
+ 2.0625
+ 2.5625
+ 3.0625
+ 3.5625
+ 4.0625
+ 4.5625
+ 5.0625
+ 5.5625
+ 6.0625
+ 6.5625
+ 7.0625
+ 7.5625
+ 14
+ 0.625
+ 1.125
+ 1.625
+ 2.125
+ 2.625
+ 3.125
+ 3.625
+ 4.125
+ 4.625
+ 5.125
+ 5.625
+ 6.125
+ 6.625
+ 7.125
+ 7.625
+ 13
+ 0.6875
+ 1.1875
+ 1.6875
+ 2.1875
+ 2.6875
+ 3.1875
+ 3.6875
+ 4.1875
+ 4.6875
+ 5.1875
+ 5.6875
+ 6.1875
+ 6.6875
+ 7.1875
+ 7.6875
+ 12
+ 0.75
+ 1.25
+ 1.75
+ 2.25
+ 2.75
+ 3.25
+ 3.75
+ 4.25
+ 4.75
+ 5.25
+ 5.75
+ 6.25
+ 6.75
+ 7.25
+ 7.75
+ 11
+ 0.8125
+ 1.3125
+ 1.8125
+ 2.3125
+ 2.8125
+ 3.3125
+ 3.8125
+ 4.3125
+ 4.8125
+ 5.3125
+ 5.8125
+ 6.3125
+ 6.8125
+ 7.3125
+ 7.8125
+ 10
+ 0.875
+ 1.375
+ 1.875
+ 2.375
+ 2.875
+ 3.375
+ 3.875
+ 4.375
+ 4.875
+ 5.375
+ 5.875
+ 6.375
+ 6.875
+ 7.375
+ 7.875
+ 9
+ 0.9375
+ 1.4375
+ 1.9375
+ 2.4375
+ 2.9375
+ 3.4375
+ 3.9375
+ 4.4375
+ 4.9375
+ 5.4375
+ 5.9375
+ 6.4375
+ 6.9375
+ 7.4375
+ 7.9375
+ </hdf5:DataFromFile>
+ </hdf5:Data>
+ </hdf5:Dataset>
+</hdf5:RootGroup>
+</hdf5:HDF5-File>
diff --git a/tools/test/h5dump/expected/xml/tfloat16_be.h5.xml b/tools/test/h5dump/expected/xml/tfloat16_be.h5.xml
new file mode 100644
index 0000000..b9116f0
--- /dev/null
+++ b/tools/test/h5dump/expected/xml/tfloat16_be.h5.xml
@@ -0,0 +1,302 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdfgroup.org/HDF5/XML/schema/HDF5-File http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd">
+<hdf5:RootGroup OBJ-XID="xid_96" H5Path="/">
+ <hdf5:Dataset Name="DS16BITS" OBJ-XID="xid_800" H5Path= "/DS16BITS" Parents="xid_96" H5ParentPaths="/">
+ <hdf5:StorageLayout>
+ <hdf5:ContiguousLayout/>
+ </hdf5:StorageLayout>
+ <hdf5:FillValueInfo FillTime="FillIfSet" AllocationTime="Late">
+ <hdf5:FillValue>
+ <hdf5:NoFill/>
+ </hdf5:FillValue>
+ </hdf5:FillValueInfo>
+ <hdf5:Dataspace>
+ <hdf5:SimpleDataspace Ndims="2">
+ <hdf5:Dimension DimSize="8" MaxDimSize="8"/>
+ <hdf5:Dimension DimSize="16" MaxDimSize="16"/>
+ </hdf5:SimpleDataspace>
+ </hdf5:Dataspace>
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:FloatType ByteOrder="BE" Size="2" SignBitLocation="15" ExponentBits="5" ExponentLocation="10" MantissaBits="10" MantissaLocation="0" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ <hdf5:Attribute Name="DS16BITS">
+ <hdf5:Dataspace>
+ <hdf5:SimpleDataspace Ndims="1">
+ <hdf5:Dimension DimSize="128" MaxDimSize="128"/>
+ </hdf5:SimpleDataspace>
+ </hdf5:Dataspace>
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:FloatType ByteOrder="BE" Size="2" SignBitLocation="15" ExponentBits="5" ExponentLocation="10" MantissaBits="10" MantissaLocation="0" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ <hdf5:Data>
+ <hdf5:DataFromFile>
+ 16
+ 0.5
+ 1
+ 1.5
+ 2
+ 2.5
+ 3
+ 3.5
+ 4
+ 4.5
+ 5
+ 5.5
+ 6
+ 6.5
+ 7
+ 7.5
+ 15
+ 0.5625
+ 1.0625
+ 1.5625
+ 2.0625
+ 2.5625
+ 3.0625
+ 3.5625
+ 4.0625
+ 4.5625
+ 5.0625
+ 5.5625
+ 6.0625
+ 6.5625
+ 7.0625
+ 7.5625
+ 14
+ 0.625
+ 1.125
+ 1.625
+ 2.125
+ 2.625
+ 3.125
+ 3.625
+ 4.125
+ 4.625
+ 5.125
+ 5.625
+ 6.125
+ 6.625
+ 7.125
+ 7.625
+ 13
+ 0.6875
+ 1.1875
+ 1.6875
+ 2.1875
+ 2.6875
+ 3.1875
+ 3.6875
+ 4.1875
+ 4.6875
+ 5.1875
+ 5.6875
+ 6.1875
+ 6.6875
+ 7.1875
+ 7.6875
+ 12
+ 0.75
+ 1.25
+ 1.75
+ 2.25
+ 2.75
+ 3.25
+ 3.75
+ 4.25
+ 4.75
+ 5.25
+ 5.75
+ 6.25
+ 6.75
+ 7.25
+ 7.75
+ 11
+ 0.8125
+ 1.3125
+ 1.8125
+ 2.3125
+ 2.8125
+ 3.3125
+ 3.8125
+ 4.3125
+ 4.8125
+ 5.3125
+ 5.8125
+ 6.3125
+ 6.8125
+ 7.3125
+ 7.8125
+ 10
+ 0.875
+ 1.375
+ 1.875
+ 2.375
+ 2.875
+ 3.375
+ 3.875
+ 4.375
+ 4.875
+ 5.375
+ 5.875
+ 6.375
+ 6.875
+ 7.375
+ 7.875
+ 9
+ 0.9375
+ 1.4375
+ 1.9375
+ 2.4375
+ 2.9375
+ 3.4375
+ 3.9375
+ 4.4375
+ 4.9375
+ 5.4375
+ 5.9375
+ 6.4375
+ 6.9375
+ 7.4375
+ 7.9375
+ </hdf5:DataFromFile>
+ </hdf5:Data>
+ </hdf5:Attribute>
+ <hdf5:Data>
+ <hdf5:DataFromFile>
+ 16
+ 0.5
+ 1
+ 1.5
+ 2
+ 2.5
+ 3
+ 3.5
+ 4
+ 4.5
+ 5
+ 5.5
+ 6
+ 6.5
+ 7
+ 7.5
+ 15
+ 0.5625
+ 1.0625
+ 1.5625
+ 2.0625
+ 2.5625
+ 3.0625
+ 3.5625
+ 4.0625
+ 4.5625
+ 5.0625
+ 5.5625
+ 6.0625
+ 6.5625
+ 7.0625
+ 7.5625
+ 14
+ 0.625
+ 1.125
+ 1.625
+ 2.125
+ 2.625
+ 3.125
+ 3.625
+ 4.125
+ 4.625
+ 5.125
+ 5.625
+ 6.125
+ 6.625
+ 7.125
+ 7.625
+ 13
+ 0.6875
+ 1.1875
+ 1.6875
+ 2.1875
+ 2.6875
+ 3.1875
+ 3.6875
+ 4.1875
+ 4.6875
+ 5.1875
+ 5.6875
+ 6.1875
+ 6.6875
+ 7.1875
+ 7.6875
+ 12
+ 0.75
+ 1.25
+ 1.75
+ 2.25
+ 2.75
+ 3.25
+ 3.75
+ 4.25
+ 4.75
+ 5.25
+ 5.75
+ 6.25
+ 6.75
+ 7.25
+ 7.75
+ 11
+ 0.8125
+ 1.3125
+ 1.8125
+ 2.3125
+ 2.8125
+ 3.3125
+ 3.8125
+ 4.3125
+ 4.8125
+ 5.3125
+ 5.8125
+ 6.3125
+ 6.8125
+ 7.3125
+ 7.8125
+ 10
+ 0.875
+ 1.375
+ 1.875
+ 2.375
+ 2.875
+ 3.375
+ 3.875
+ 4.375
+ 4.875
+ 5.375
+ 5.875
+ 6.375
+ 6.875
+ 7.375
+ 7.875
+ 9
+ 0.9375
+ 1.4375
+ 1.9375
+ 2.4375
+ 2.9375
+ 3.4375
+ 3.9375
+ 4.4375
+ 4.9375
+ 5.4375
+ 5.9375
+ 6.4375
+ 6.9375
+ 7.4375
+ 7.9375
+ </hdf5:DataFromFile>
+ </hdf5:Data>
+ </hdf5:Dataset>
+</hdf5:RootGroup>
+</hdf5:HDF5-File>
diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c
index 9c42a0e..46e0f99 100644
--- a/tools/test/h5dump/h5dumpgentest.c
+++ b/tools/test/h5dump/h5dumpgentest.c
@@ -119,6 +119,10 @@
#define FILE90 "tst_onion_dset_1d.h5"
#define FILE91 "tst_onion_objs.h5"
#define FILE92 "tst_onion_dset_ext.h5"
+#ifdef H5_HAVE__FLOAT16
+#define FILE93 "tfloat16.h5"
+#define FILE94 "tfloat16_be.h5"
+#endif
#define ONION_TEST_FIXNAME_SIZE 1024
#define ONION_TEST_PAGE_SIZE (uint32_t)32
@@ -412,6 +416,18 @@ typedef struct s1_t {
#define F89_DATASETF128 "DS128BITS"
#define F89_YDIM128 128
+#ifdef H5_HAVE__FLOAT16
+/* "FILE93" macros */
+#define F93_XDIM 8
+#define F93_YDIM 16
+#define F93_DATASET "DS16BITS"
+
+/* "FILE94" macros */
+#define F94_XDIM 8
+#define F94_YDIM 16
+#define F94_DATASET "DS16BITS"
+#endif
+
static void
gent_group(void)
{
@@ -11993,6 +12009,148 @@ error:
return -1;
} /* gent_onion_dset_extension */
+#ifdef H5_HAVE__FLOAT16
+static void
+gent_float16(void)
+{
+ hid_t fid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t attr = H5I_INVALID_HID;
+ hid_t dataset = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t aspace = H5I_INVALID_HID;
+ hsize_t dims[2], adims[1];
+
+ struct {
+ H5__Float16 arr[F93_XDIM][F93_YDIM];
+ } * dset16;
+
+ H5__Float16 *aset16 = NULL;
+ H5__Float16 val16bits;
+
+ dset16 = malloc(sizeof(*dset16));
+
+ aset16 = calloc(F93_XDIM * F93_YDIM, sizeof(H5__Float16));
+
+ fid = H5Fcreate(FILE93, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ if ((tid = H5Tcopy(H5T_NATIVE_FLOAT16)) < 0)
+ goto error;
+
+ if (H5Tget_size(tid) == 0)
+ goto error;
+
+ /* Dataset of 16-bit little-endian float */
+ dims[0] = F93_XDIM;
+ dims[1] = F93_YDIM;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, F93_DATASET, H5T_IEEE_F16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ val16bits = (H5__Float16)F93_YDIM;
+ for (size_t i = 0; i < dims[0]; i++) {
+ dset16->arr[i][0] = val16bits;
+ aset16[i * dims[1]] = dset16->arr[i][0];
+
+ for (size_t j = 1; j < dims[1]; j++) {
+ dset16->arr[i][j] = (H5__Float16)(j * dims[0] + i) / (H5__Float16)F93_YDIM;
+ aset16[i * dims[1] + j] = dset16->arr[i][j];
+ }
+
+ val16bits -= (H5__Float16)1;
+ }
+
+ H5Dwrite(dataset, H5T_IEEE_F16LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16);
+
+ /* Attribute of 16-bit little-endian float */
+ adims[0] = F93_XDIM * F93_YDIM;
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F93_DATASET, H5T_IEEE_F16LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+
+ H5Awrite(attr, H5T_IEEE_F16LE, aset16);
+
+ H5Aclose(attr);
+ H5Sclose(aspace);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+error:
+ free(aset16);
+ free(dset16);
+
+ H5Fclose(fid);
+}
+
+static void
+gent_float16_be(void)
+{
+ hid_t fid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t attr = H5I_INVALID_HID;
+ hid_t dataset = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t aspace = H5I_INVALID_HID;
+ hsize_t dims[2], adims[1];
+
+ struct {
+ H5__Float16 arr[F94_XDIM][F94_YDIM];
+ } * dset16;
+
+ H5__Float16 *aset16 = NULL;
+ H5__Float16 val16bits;
+
+ dset16 = malloc(sizeof(*dset16));
+
+ aset16 = calloc(F94_XDIM * F94_YDIM, sizeof(H5__Float16));
+
+ fid = H5Fcreate(FILE94, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ if ((tid = H5Tcopy(H5T_NATIVE_FLOAT16)) < 0)
+ goto error;
+
+ if (H5Tget_size(tid) == 0)
+ goto error;
+
+ /* Dataset of 16-bit big-endian float */
+ dims[0] = F94_XDIM;
+ dims[1] = F94_YDIM;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, F94_DATASET, H5T_IEEE_F16BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ val16bits = (H5__Float16)F94_YDIM;
+ for (size_t i = 0; i < dims[0]; i++) {
+ dset16->arr[i][0] = val16bits;
+ aset16[i * dims[1]] = dset16->arr[i][0];
+
+ for (size_t j = 1; j < dims[1]; j++) {
+ dset16->arr[i][j] = (H5__Float16)(j * dims[0] + i) / (H5__Float16)F94_YDIM;
+ aset16[i * dims[1] + j] = dset16->arr[i][j];
+ }
+
+ val16bits -= (H5__Float16)1;
+ }
+
+ H5Dwrite(dataset, H5T_IEEE_F16LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16);
+
+ /* Attribute of 16-bit big-endian float */
+ adims[0] = F94_XDIM * F94_YDIM;
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F94_DATASET, H5T_IEEE_F16BE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+
+ H5Awrite(attr, H5T_IEEE_F16LE, aset16);
+
+ H5Aclose(attr);
+ H5Sclose(aspace);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+error:
+ free(aset16);
+ free(dset16);
+
+ H5Fclose(fid);
+}
+#endif
+
int
main(void)
{
@@ -12097,5 +12255,10 @@ main(void)
gent_onion_create_delete_objects();
gent_onion_dset_extension();
+#ifdef H5_HAVE__FLOAT16
+ gent_float16();
+ gent_float16_be();
+#endif
+
return 0;
}
diff --git a/tools/test/h5dump/testfiles/tfloat16.h5 b/tools/test/h5dump/testfiles/tfloat16.h5
new file mode 100644
index 0000000..a0cccc5
--- /dev/null
+++ b/tools/test/h5dump/testfiles/tfloat16.h5
Binary files differ
diff --git a/tools/test/h5dump/testfiles/tfloat16_be.h5 b/tools/test/h5dump/testfiles/tfloat16_be.h5
new file mode 100644
index 0000000..f0d656a
--- /dev/null
+++ b/tools/test/h5dump/testfiles/tfloat16_be.h5
Binary files differ
diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in
index 4734865..daba93b 100644
--- a/tools/test/h5dump/testh5dump.sh.in
+++ b/tools/test/h5dump/testh5dump.sh.in
@@ -133,6 +133,8 @@ $SRC_H5DUMP_TESTFILES/tfcontents1.h5
$SRC_H5DUMP_TESTFILES/tfcontents2.h5
$SRC_H5DUMP_TESTFILES/tfilters.h5
$SRC_H5DUMP_TESTFILES/tfloatsattrs.h5
+$SRC_H5DUMP_TESTFILES/tfloat16.h5
+$SRC_H5DUMP_TESTFILES/tfloat16_be.h5
$SRC_H5DUMP_TESTFILES/tfpformat.h5
$SRC_H5DUMP_TESTFILES/tfvalues.h5
$SRC_H5DUMP_TESTFILES/tgroup.h5
@@ -273,6 +275,8 @@ $SRC_H5DUMP_OUTFILES/tfamily.ddl
$SRC_H5DUMP_OUTFILES/tfill.ddl
$SRC_H5DUMP_OUTFILES/tfletcher32.ddl
$SRC_H5DUMP_OUTFILES/tfloatsattrs.ddl
+$SRC_H5DUMP_OUTFILES/tfloat16.ddl
+$SRC_H5DUMP_OUTFILES/tfloat16_be.ddl
$SRC_H5DUMP_OUTFILES/tfpformat.ddl
$SRC_H5DUMP_OUTFILES/tgroup-1.ddl
$SRC_H5DUMP_OUTFILES/tgroup-2.ddl
@@ -1467,6 +1471,10 @@ TOOLTEST tfloatsattrs.ddl -p --enable-error-stack tfloatsattrs.h5
TOOLTEST tldouble.ddl --enable-error-stack tldouble.h5
TOOLTEST tldouble_scalar.ddl -p --enable-error-stack tldouble_scalar.h5
+# tests for _Float16 type
+TOOLTEST tfloat16.ddl --enable-error-stack tfloat16.h5
+TOOLTEST tfloat16_be.ddl --enable-error-stack tfloat16_be.h5
+
# test for vms
TOOLTEST tvms.ddl --enable-error-stack tvms.h5
diff --git a/tools/test/h5dump/testh5dumpxml.sh.in b/tools/test/h5dump/testh5dumpxml.sh.in
index 880fc6b..b95d5c4 100644
--- a/tools/test/h5dump/testh5dumpxml.sh.in
+++ b/tools/test/h5dump/testh5dumpxml.sh.in
@@ -100,6 +100,8 @@ $SRC_H5DUMP_TESTFILES/tdatareg.h5
$SRC_H5DUMP_TESTFILES/tdset.h5
$SRC_H5DUMP_TESTFILES/tempty.h5
$SRC_H5DUMP_TESTFILES/textlink.h5
+$SRC_H5DUMP_TESTFILES/tfloat16.h5
+$SRC_H5DUMP_TESTFILES/tfloat16_be.h5
$SRC_H5DUMP_TESTFILES/tfpformat.h5
$SRC_H5DUMP_TESTFILES/tgroup.h5
$SRC_H5DUMP_TESTFILES/thlink.h5
@@ -150,6 +152,8 @@ $SRC_H5DUMP_OUTFILES/xml/tempty-ns-2.h5.xml
$SRC_H5DUMP_OUTFILES/xml/tenum.h5.xml
$SRC_H5DUMP_OUTFILES/xml/test35.nc.xml
$SRC_H5DUMP_OUTFILES/xml/textlink.h5.xml
+$SRC_H5DUMP_OUTFILES/xml/tfloat16.h5.xml
+$SRC_H5DUMP_OUTFILES/xml/tfloat16_be.h5.xml
$SRC_H5DUMP_OUTFILES/xml/tfpformat.h5.xml
$SRC_H5DUMP_OUTFILES/xml/tgroup.h5.xml
$SRC_H5DUMP_OUTFILES/xml/thlink.h5.xml
@@ -383,6 +387,10 @@ TOOLTEST torderattr2.h5.xml --xml -H --sort_by=name --sort_order=descending tord
TOOLTEST torderattr3.h5.xml --xml -H --sort_by=creation_order --sort_order=ascending torderattr.h5
TOOLTEST torderattr4.h5.xml --xml -H --sort_by=creation_order --sort_order=descending torderattr.h5
+# tests for _Float16 type
+TOOLTEST tfloat16.h5.xml --xml tfloat16.h5
+TOOLTEST tfloat16_be.h5.xml --xml tfloat16_be.h5
+
# tests for floating point user defined printf format
TOOLTEST tfpformat.h5.xml -u -m %.7f tfpformat.h5
diff --git a/tools/test/h5ls/CMakeTests.cmake b/tools/test/h5ls/CMakeTests.cmake
index 02b1dfe..2aefdb6 100644
--- a/tools/test/h5ls/CMakeTests.cmake
+++ b/tools/test/h5ls/CMakeTests.cmake
@@ -35,6 +35,8 @@
textlink.h5
textlinksrc.h5
textlinktar.h5
+ tfloat16.h5
+ tfloat16_be.h5
tgroup.h5
tgrp_comments.h5
tgrpnullspace.h5
@@ -88,6 +90,10 @@
textlinksrc-7-old.ls
textlinksrc-nodangle-1.ls
textlinksrc-nodangle-2.ls
+ tfloat16.ls
+ tfloat16_nosupport.ls
+ tfloat16_be.ls
+ tfloat16_be_nosupport.ls
tgroup.ls
tgroup-1.ls
tgroup-2.ls
@@ -314,6 +320,33 @@
# when used file with no dangling links - expected exit code 0
ADD_H5_TEST (thlinks-nodangle-1 0 -w80 --follow-symlinks --no-dangling-links thlink.h5)
+ # tests for _Float16 type
+ if (${${HDF_PREFIX}_HAVE__FLOAT16})
+ # If support is available for _Float16 type, the second test
+ # will fail as the type will be printed out as "native _Float16"
+ # rather than "IEEE 16-bit little-endian float".
+ if (H5_WORDS_BIGENDIAN)
+ ADD_H5_TEST (tfloat16_be 0 -w80 -v tfloat16_be.h5)
+ ADD_H5_TEST (tfloat16_be_nosupport 0 -w80 -v tfloat16_be.h5)
+ set_tests_properties (H5LS-tfloat16_be_nosupport PROPERTIES WILL_FAIL "true")
+ else ()
+ ADD_H5_TEST (tfloat16 0 -w80 -v tfloat16.h5)
+ ADD_H5_TEST (tfloat16_nosupport 0 -w80 -v tfloat16.h5)
+ set_tests_properties (H5LS-tfloat16_nosupport PROPERTIES WILL_FAIL "true")
+ endif ()
+ else ()
+ # If support is NOT available for _Float16 type, the first two tests
+ # will fail as the types will be printed out as
+ # "IEEE 16-bit little-endian float" and "IEEE 16-bit big-endian float"
+ # rather than "native _Float16"
+ ADD_H5_TEST (tfloat16 0 -w80 -v tfloat16.h5)
+ set_tests_properties (H5LS-tfloat16 PROPERTIES WILL_FAIL "true")
+ ADD_H5_TEST (tfloat16_be 0 -w80 -v tfloat16_be.h5)
+ set_tests_properties (H5LS-tfloat16_be PROPERTIES WILL_FAIL "true")
+ ADD_H5_TEST (tfloat16_nosupport 0 -w80 -v tfloat16.h5)
+ ADD_H5_TEST (tfloat16_be_nosupport 0 -w80 -v tfloat16_be.h5)
+ endif ()
+
# test for wildcards in filename (does not work with cmake)
# ADD_H5_TEST (tstarfile 0 -w80 t*link.h5)
# ADD_H5_TEST (tqmarkfile 0 -w80 t?link.h5)
diff --git a/tools/test/h5ls/expected/tfloat16.ls b/tools/test/h5ls/expected/tfloat16.ls
new file mode 100644
index 0000000..68c0fe7
--- /dev/null
+++ b/tools/test/h5ls/expected/tfloat16.ls
@@ -0,0 +1,8 @@
+Opened "tfloat16.h5" with sec2 driver.
+DS16BITS Dataset {8/8, 16/16}
+ Attribute: DS16BITS {128}
+ Type: native _Float16
+ Location: 1:800
+ Links: 1
+ Storage: 256 logical bytes, 256 allocated bytes, 100.00% utilization
+ Type: native _Float16
diff --git a/tools/test/h5ls/expected/tfloat16_be.ls b/tools/test/h5ls/expected/tfloat16_be.ls
new file mode 100644
index 0000000..6a2e7de
--- /dev/null
+++ b/tools/test/h5ls/expected/tfloat16_be.ls
@@ -0,0 +1,8 @@
+Opened "tfloat16_be.h5" with sec2 driver.
+DS16BITS Dataset {8/8, 16/16}
+ Attribute: DS16BITS {128}
+ Type: native _Float16
+ Location: 1:800
+ Links: 1
+ Storage: 256 logical bytes, 256 allocated bytes, 100.00% utilization
+ Type: native _Float16
diff --git a/tools/test/h5ls/expected/tfloat16_be_nosupport.ls b/tools/test/h5ls/expected/tfloat16_be_nosupport.ls
new file mode 100644
index 0000000..1c6911d
--- /dev/null
+++ b/tools/test/h5ls/expected/tfloat16_be_nosupport.ls
@@ -0,0 +1,8 @@
+Opened "tfloat16_be.h5" with sec2 driver.
+DS16BITS Dataset {8/8, 16/16}
+ Attribute: DS16BITS {128}
+ Type: IEEE 16-bit big-endian float
+ Location: 1:800
+ Links: 1
+ Storage: 256 logical bytes, 256 allocated bytes, 100.00% utilization
+ Type: IEEE 16-bit big-endian float
diff --git a/tools/test/h5ls/expected/tfloat16_nosupport.ls b/tools/test/h5ls/expected/tfloat16_nosupport.ls
new file mode 100644
index 0000000..70253c6
--- /dev/null
+++ b/tools/test/h5ls/expected/tfloat16_nosupport.ls
@@ -0,0 +1,8 @@
+Opened "tfloat16.h5" with sec2 driver.
+DS16BITS Dataset {8/8, 16/16}
+ Attribute: DS16BITS {128}
+ Type: IEEE 16-bit little-endian float
+ Location: 1:800
+ Links: 1
+ Storage: 256 logical bytes, 256 allocated bytes, 100.00% utilization
+ Type: IEEE 16-bit little-endian float
diff --git a/tools/test/h5ls/testh5ls.sh.in b/tools/test/h5ls/testh5ls.sh.in
index 01f9402..478e5b7 100644
--- a/tools/test/h5ls/testh5ls.sh.in
+++ b/tools/test/h5ls/testh5ls.sh.in
@@ -16,6 +16,8 @@ srcdir=@srcdir@
USE_FILTER_SZIP="@USE_FILTER_SZIP@"
USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@"
+HAVE__FLOAT16="@HAVE__FLOAT16@"
+WORDS_BIGENDIAN="@WORDS_BIGENDIAN@"
TESTNAME=h5ls
EXIT_SUCCESS=0
@@ -78,6 +80,8 @@ $SRC_H5DUMP_TESTFILES/tempty.h5
$SRC_H5DUMP_TESTFILES/textlink.h5
$SRC_H5DUMP_TESTFILES/textlinksrc.h5
$SRC_H5DUMP_TESTFILES/textlinktar.h5
+$SRC_H5DUMP_TESTFILES/tfloat16.h5
+$SRC_H5DUMP_TESTFILES/tfloat16_be.h5
$SRC_H5DUMP_TESTFILES/tgroup.h5
$SRC_H5DUMP_TESTFILES/tgrp_comments.h5
$SRC_H5DUMP_TESTFILES/tgrpnullspace.h5
@@ -128,6 +132,10 @@ $SRC_H5LS_OUTFILES/textlinksrc-2-old.ls
$SRC_H5LS_OUTFILES/textlinksrc-3-old.ls
$SRC_H5LS_OUTFILES/textlinksrc-6-old.ls
$SRC_H5LS_OUTFILES/textlinksrc-7-old.ls
+$SRC_H5LS_OUTFILES/tfloat16.ls
+$SRC_H5LS_OUTFILES/tfloat16_nosupport.ls
+$SRC_H5LS_OUTFILES/tfloat16_be.ls
+$SRC_H5LS_OUTFILES/tfloat16_be_nosupport.ls
$SRC_H5LS_OUTFILES/tsoftlinks-1.ls
$SRC_H5LS_OUTFILES/tsoftlinks-2.ls
$SRC_H5LS_OUTFILES/tsoftlinks-3.ls
@@ -361,6 +369,18 @@ TOOLTEST tsoftlinks-nodangle-1.ls 1 -w80 --follow-symlinks --no-dangling-links t
# when used file with no dangling links - expected exit code 0
TOOLTEST thlinks-nodangle-1.ls 0 -w80 --follow-symlinks --no-dangling-links thlink.h5
+# test for _Float16 type
+if test $HAVE__FLOAT16 = "yes" ; then
+ if test $WORDS_BIGENDIAN = "yes" ; then
+ TOOLTEST tfloat16_be.ls 0 -w80 -v tfloat16_be.h5
+ else
+ TOOLTEST tfloat16.ls 0 -w80 -v tfloat16.h5
+ fi
+else
+ TOOLTEST tfloat16_nosupport.ls 0 -w80 -v tfloat16.h5
+ TOOLTEST tfloat16_be_nosupport.ls 0 -w80 -v tfloat16_be.h5
+fi
+
# test for wildcards in filename (does not work with cmake)
# this h5ls test script does not pass the filename properly like the h5dump test script???
#TOOLTEST tstarfile.ls 0 -w80 t*link.h5