From 6a8075fcdfd088470ddc2d50ff59c1d073a63088 Mon Sep 17 00:00:00 2001 From: Lazar Kovacic Date: Thu, 18 May 2023 00:59:23 +0200 Subject: [PATCH] Simplify the decrease channel formula --- examples/tv-app/linux/include/channel/ChannelManager.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/examples/tv-app/linux/include/channel/ChannelManager.cpp b/examples/tv-app/linux/include/channel/ChannelManager.cpp index 5156cd3d096945..3f49a3a81bf26e 100644 --- a/examples/tv-app/linux/include/channel/ChannelManager.cpp +++ b/examples/tv-app/linux/include/channel/ChannelManager.cpp @@ -179,15 +179,11 @@ bool ChannelManager::HandleSkipChannel(const int16_t & count) uint16_t channelsSize = static_cast(mChannels.size()); // handle larger than maximum -> channel size case - if (newChannelIndex >= channelsSize) - { - newChannelIndex = newChannelIndex % channelsSize; - } + newChannelIndex = newChannelIndex % channelsSize; - // handle smaller than 0 if (newChannelIndex < 0) { - newChannelIndex = (newChannelIndex % channelsSize) % channelsSize; + newChannelIndex = (newChannelIndex + channelsSize) % channelsSize; } mCurrentChannelIndex = static_cast(newChannelIndex);