aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/utils
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2017-01-05 09:32:23 -0800
committerMartin Braun <martin.braun@ettus.com>2017-01-05 09:32:23 -0800
commit75f3270d0cc199bf0665bc1612fe8e1b020aee1f (patch)
treee5960aaf348a7e8ad11e5385eea944165228c9af /host/lib/utils
parent01181d2fa6270fbbbc34ff4cb1e75b44cb7f9e1b (diff)
parentf86f209b3370be54ec0870186ab1b9d8988736eb (diff)
downloaduhd-75f3270d0cc199bf0665bc1612fe8e1b020aee1f.tar.gz
uhd-75f3270d0cc199bf0665bc1612fe8e1b020aee1f.tar.bz2
uhd-75f3270d0cc199bf0665bc1612fe8e1b020aee1f.zip
Merge branch 'maint'
Diffstat (limited to 'host/lib/utils')
-rw-r--r--host/lib/utils/CMakeLists.txt4
-rw-r--r--host/lib/utils/gain_group.cpp8
2 files changed, 8 insertions, 4 deletions
diff --git a/host/lib/utils/CMakeLists.txt b/host/lib/utils/CMakeLists.txt
index 790ef72ad..128d7c00a 100644
--- a/host/lib/utils/CMakeLists.txt
+++ b/host/lib/utils/CMakeLists.txt
@@ -116,8 +116,8 @@ SET_SOURCE_FILES_PROPERTIES(
########################################################################
# Define UHD_PKG_DATA_PATH for paths.cpp
########################################################################
-FILE(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX} UHD_PKG_PATH)
-STRING(REPLACE "\\" "\\\\" UHD_PKG_PATH ${UHD_PKG_PATH})
+FILE(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}" UHD_PKG_PATH)
+STRING(REPLACE "\\" "\\\\" UHD_PKG_PATH "${UHD_PKG_PATH}")
STRING(REGEX MATCH ".*/.*" SLASH "${LIB_SUFFIX}")
IF(SLASH STREQUAL "")
diff --git a/host/lib/utils/gain_group.cpp b/host/lib/utils/gain_group.cpp
index 9428702d1..71caf33be 100644
--- a/host/lib/utils/gain_group.cpp
+++ b/host/lib/utils/gain_group.cpp
@@ -39,7 +39,7 @@ static bool compare_by_step_size(
*
* Due to small doubleing-point inaccuracies:
* num = n*step + e, where e is a small inaccuracy.
- * When e is negative, floor would yeild (n-1)*step,
+ * When e is negative, floor would yield (n-1)*step,
* despite that n*step is really the desired result.
* This function is designed to mitigate that issue.
*
@@ -49,7 +49,11 @@ static bool compare_by_step_size(
* \return a multiple of step approximating num
*/
template <typename T> static T floor_step(T num, T step, T e = T(0.001)){
- return step*int(num/step + e);
+ if (num < T(0)) {
+ return step*int(num/step - e);
+ } else {
+ return step*int(num/step + e);
+ }
}
gain_group::~gain_group(void){