From e53e4ed23c54b6ecdd32691a618912b9158161fe Mon Sep 17 00:00:00 2001 From: codingjourney Date: Sat, 14 Dec 2024 07:27:56 +0100 Subject: tightened declarations of integer fields --- src/components/stopwatch/StopWatchController.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/components/stopwatch/StopWatchController.cpp') diff --git a/src/components/stopwatch/StopWatchController.cpp b/src/components/stopwatch/StopWatchController.cpp index 4979ee68..d21f6508 100644 --- a/src/components/stopwatch/StopWatchController.cpp +++ b/src/components/stopwatch/StopWatchController.cpp @@ -22,7 +22,7 @@ void StopWatchController::Clear() { currentState = StopWatchStates::Cleared; timeElapsedPreviously = 0; - for (int i = 0; i < histSize; i++) { + for (uint8_t i = 0; i < histSize; i++) { history[i].number = 0; history[i].timeSinceStart = 0; } @@ -38,12 +38,12 @@ void StopWatchController::AddLapToHistory() { history[0].number = ++maxLapNumber % lapNumberBoundary; } -int StopWatchController::GetMaxLapNumber() { +uint16_t StopWatchController::GetMaxLapNumber() { return maxLapNumber; } -std::optional StopWatchController::GetLapFromHistory(int index) { - if (index < 0 || index >= histSize || history[index].number == 0) { +std::optional StopWatchController::GetLapFromHistory(uint8_t index) { + if (index >= histSize || history[index].number == 0) { return {}; } return history[index]; -- cgit v1.2.3-70-g09d2