diff options
author | Lars Amsel <lars.amsel@ni.com> | 2022-05-12 20:11:12 +0200 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2022-06-10 13:24:04 -0500 |
commit | 13ccc20463093d47ecb0f9562d63414ec0d7287c (patch) | |
tree | ff6f2a80b0e0fb72c8190532efbc508361edfbd0 /host | |
parent | 03b493c129f06147a6e59ecbade9fa02fc468b06 (diff) | |
download | uhd-13ccc20463093d47ecb0f9562d63414ec0d7287c.tar.gz uhd-13ccc20463093d47ecb0f9562d63414ec0d7287c.tar.bz2 uhd-13ccc20463093d47ecb0f9562d63414ec0d7287c.zip |
rfnoc: fix double conversions
result of get double was saved in an int value instead of double
replaced C cast by static_cast
Diffstat (limited to 'host')
-rw-r--r-- | host/lib/rfnoc/rfnoc_python.hpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/host/lib/rfnoc/rfnoc_python.hpp b/host/lib/rfnoc/rfnoc_python.hpp index cd40afebd..d041ee99e 100644 --- a/host/lib/rfnoc/rfnoc_python.hpp +++ b/host/lib/rfnoc/rfnoc_python.hpp @@ -510,12 +510,11 @@ void export_rfnoc(py::module& m) [](noc_block_base& self, const std::string& id, const size_t instance) -> double { // Try both float types try { - int value = self.get_property<double>(id, instance); - return (double)value; + return self.get_property<double>(id, instance); } catch(const uhd::type_error&) { try { - size_t value = self.get_property<float>(id, instance); - return (double)value; + float value = self.get_property<float>(id, instance); + return static_cast<double>(value); } catch(...) { throw; } |