summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2020-02-02 21:21:57 -0800
committerRosen Penev <rosenp@gmail.com>2020-03-15 20:17:31 -0700
commit3ec9fcfc443a68c9f57e0314c47e70ca02a32530 (patch)
treee92291e958bc2368eb7c7a43dee8ceeae7efea6a /src/util
parentb5d1a0901022d4711973740edadd87ce5913ac68 (diff)
treewide: use boost::lround when std::round is unavailable
This is the case with uClibc-ng currently. Signed-off-by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'src/util')
-rw-r--r--src/util/Math.hxx41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/util/Math.hxx b/src/util/Math.hxx
new file mode 100644
index 000000000..bd856f5a9
--- /dev/null
+++ b/src/util/Math.hxx
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2018 Max Kellermann <max.kellermann@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MATH_HXX
+#define MATH_HXX
+
+#ifdef __UCLIBC__
+#include <boost/math/special_functions/round.hpp>
+using boost::math::lround;
+#else
+#include <cmath>
+using std::lround;
+#endif
+
+#endif