aboutsummaryrefslogtreecommitdiffstats
path: root/utils/uhjencoder.cpp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-11-28 12:51:46 +0100
committerSven Gothel <[email protected]>2023-11-28 12:51:46 +0100
commit1aaf4f070011490bcece50394b9b32dfa593fd9e (patch)
tree17d68284e401a35eea3d3a574d986d446a60763a /utils/uhjencoder.cpp
parent6e7cee4fa9a8af03f28ca26cd89f8357390dfc90 (diff)
parent571b546f35eead77ce109f8d4dd6c3de3199d573 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'utils/uhjencoder.cpp')
-rw-r--r--utils/uhjencoder.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/utils/uhjencoder.cpp b/utils/uhjencoder.cpp
index 34698993..154a1155 100644
--- a/utils/uhjencoder.cpp
+++ b/utils/uhjencoder.cpp
@@ -25,8 +25,8 @@
#include "config.h"
#include <array>
+#include <cinttypes>
#include <cstring>
-#include <inttypes.h>
#include <memory>
#include <stddef.h>
#include <string>
@@ -325,7 +325,7 @@ int main(int argc, char **argv)
return false;
for(const int id : a)
{
- if(std::find(b.begin(), b.end(), id) != b.end())
+ if(std::find(b.begin(), b.end(), id) == b.end())
return false;
}
return true;
@@ -502,11 +502,9 @@ int main(int argc, char **argv)
got -= LeadIn;
for(size_t c{0};c < uhjchans;++c)
{
- constexpr float max_val{8388607.0f / 8388608.0f};
- auto clamp = [](float v, float mn, float mx) noexcept
- { return std::min(std::max(v, mn), mx); };
+ static constexpr float max_val{8388607.0f / 8388608.0f};
for(size_t i{0};i < got;++i)
- outmem[i*uhjchans + c] = clamp(encmem[c][LeadIn+i], -1.0f, max_val);
+ outmem[i*uhjchans + c] = std::clamp(encmem[c][LeadIn+i], -1.0f, max_val);
}
LeadIn = 0;