summaryrefslogtreecommitdiffstats
path: root/src/H5system.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2016-12-07 22:21:07 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2016-12-07 22:21:07 (GMT)
commit16a5c7c8f309042c7bb3a40cdb4c60f5b2c587c2 (patch)
tree5d306581d541a99f19d269e1d5a3425527a8a43b /src/H5system.c
parentf3dfc133cc68a8dfc285ae9e7e9cf85216bb3dcf (diff)
parentfeaaae4897d4c2d9f83a2f93224123a4c5e009c7 (diff)
downloadhdf5-16a5c7c8f309042c7bb3a40cdb4c60f5b2c587c2.zip
hdf5-16a5c7c8f309042c7bb3a40cdb4c60f5b2c587c2.tar.gz
hdf5-16a5c7c8f309042c7bb3a40cdb4c60f5b2c587c2.tar.bz2
Merge branch 'develop' into eoc_h5fs_fix
Diffstat (limited to 'src/H5system.c')
-rw-r--r--src/H5system.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/H5system.c b/src/H5system.c
index 5205d08..4aada77 100644
--- a/src/H5system.c
+++ b/src/H5system.c
@@ -932,6 +932,56 @@ Wnanosleep(uint64_t nanosec)
FUNC_LEAVE_NOAPI_VOID
} /* end Wnanosleep() */
+
+/*-------------------------------------------------------------------------
+ * Function: Wllround, Wllroundf, Wlround, Wlroundf, Wround, Wroundf
+ *
+ * Purpose: Wrapper function for round functions for use with VS2012
+ * and earlier.
+ *
+ * Return: The rounded value that was passed in.
+ *
+ * Programmer: Dana Robinson
+ * December 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+long long
+Wllround(double arg)
+{
+ return (long long)(arg < 0.0 ? HDceil(arg - 0.5) : HDfloor(arg + 0.5));
+}
+
+long long
+Wllroundf(float arg)
+{
+ return (long long)(arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F));
+}
+
+long
+Wlround(double arg)
+{
+ return (long)(arg < 0.0 ? HDceil(arg - 0.5) : HDfloor(arg + 0.5));
+}
+
+long
+Wlroundf(float arg)
+{
+ return (long)(arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F));
+}
+
+double
+Wround(double arg)
+{
+ return arg < 0.0 ? HDceil(arg - 0.5) : HDfloor(arg + 0.5);
+}
+
+float
+Wroundf(float arg)
+{
+ return arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F);
+}
+
#endif /* H5_HAVE_WIN32_API */