MIDIDecoder: Make use of std::clamp() within clamp7()

We can simplify the implementation of clamp7() with the use of
std::clamp().
This commit is contained in:
Lioncash 2019-08-24 22:47:06 -04:00
parent e48a094198
commit e7fe7ff49f
1 changed files with 1 additions and 1 deletions

View File

@ -9,7 +9,7 @@
namespace boo { namespace boo {
namespace { namespace {
constexpr uint8_t clamp7(uint8_t val) { return std::max(0, std::min(127, int(val))); } constexpr uint8_t clamp7(uint8_t val) { return std::clamp(val, uint8_t{0}, uint8_t{127}); }
std::optional<uint32_t> readContinuedValue(std::vector<uint8_t>::const_iterator& it, std::optional<uint32_t> readContinuedValue(std::vector<uint8_t>::const_iterator& it,
std::vector<uint8_t>::const_iterator end) { std::vector<uint8_t>::const_iterator end) {