Skip to content

Commit

Permalink
Simplify the decrease channel formula
Browse files Browse the repository at this point in the history
  • Loading branch information
lazarkov committed May 17, 2023
1 parent 642fb1e commit 6a8075f
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions examples/tv-app/linux/include/channel/ChannelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,11 @@ bool ChannelManager::HandleSkipChannel(const int16_t & count)
uint16_t channelsSize = static_cast<uint16_t>(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<uint16_t>(newChannelIndex);
Expand Down

0 comments on commit 6a8075f

Please sign in to comment.