[opengm] 01/04: support big endian
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Sat Sep 10 22:43:42 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/master
in repository opengm.
commit 109ab4d49eb86359d07d5c6b88cc0c119f0fc230
Author: Joerg Kappes <kappes at math.uni-heidelberg.de>
Date: Mon Sep 5 21:48:05 2016 +0200
support big endian
---
CMakeLists.txt | 6 +++
.../opengm/datastructures/marray/marray_hdf5.hxx | 47 ++++++++++++++++++++++
2 files changed, 53 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index eb57029..cb68cb8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -97,6 +97,12 @@ OPTION(BUILD_MATLAB_WRAPPER "Build matlab wrapper" OFF)
OPTION(WITH_MEMINFO "Use memory logging in visitor" OFF)
+INCLUDE(TestBigEndian)
+TEST_BIG_ENDIAN(BIGENDIAN)
+IF(${BIGENDIAN})
+ ADD_DEFINITIONS(-DBIGENDIAN)
+ENDIF(${BIGENDIAN})
+
#--------------------------------------------------------------
# MEMINFO
#--------------------------------------------------------------
diff --git a/include/opengm/datastructures/marray/marray_hdf5.hxx b/include/opengm/datastructures/marray/marray_hdf5.hxx
index 8e292f1..fb8ab88 100644
--- a/include/opengm/datastructures/marray/marray_hdf5.hxx
+++ b/include/opengm/datastructures/marray/marray_hdf5.hxx
@@ -82,6 +82,52 @@ template<class T, class BaseIterator, class ShapeIterator>
// type conversion from C++ to HDF5
+#ifdef BIGENDIAN
+// \cond suppress doxygen
+template<class T>
+inline hid_t uintTypeHelper() {
+ switch(sizeof(T)) {
+ case 1:
+ return H5T_STD_U8BE;
+ case 2:
+ return H5T_STD_U16BE;
+ case 4:
+ return H5T_STD_U32BE;
+ case 8:
+ return H5T_STD_U64BE;
+ default:
+ throw std::runtime_error("No matching HDF5 type.");
+ }
+}
+
+template<class T>
+inline hid_t intTypeHelper() {
+ switch(sizeof(T)) {
+ case 1:
+ return H5T_STD_I8BE;
+ case 2:
+ return H5T_STD_I16BE;
+ case 4:
+ return H5T_STD_I32BE;
+ case 8:
+ return H5T_STD_I64BE;
+ default:
+ throw std::runtime_error("No matching HDF5 type.");
+ }
+}
+
+template<class T>
+inline hid_t floatingTypeHelper() {
+ switch(sizeof(T)) {
+ case 4:
+ return H5T_IEEE_F32BE;
+ case 8:
+ return H5T_IEEE_F64BE;
+ default:
+ throw std::runtime_error("No matching HDF5 type.");
+ }
+}
+#else
// \cond suppress doxygen
template<class T>
inline hid_t uintTypeHelper() {
@@ -126,6 +172,7 @@ inline hid_t floatingTypeHelper() {
throw std::runtime_error("No matching HDF5 type.");
}
}
+#endif
template<class T>
inline hid_t hdf5Type();
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/opengm.git
More information about the debian-science-commits
mailing list