File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed
Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -24,10 +24,9 @@ namespace gameanalytics
2424 void GAHealth::doFpsReading (float fps)
2525 {
2626 int fpsBucket = std::round (fps);
27- if (fpsBucket >= 0 && fpsBucket < MAX_FPS_COUNT)
28- {
29- _fpsReadings[fpsBucket]++;
30- }
27+ fpsBucket = std::clamp (fpsBucket, 0 , MAX_FPS_VALUE);
28+
29+ _fpsReadings[fpsBucket]++;
3130 }
3231
3332 int GAHealth::getMemoryPercent (int64_t memory)
@@ -169,7 +168,6 @@ namespace gameanalytics
169168 }
170169 }
171170 );
172-
173171 }
174172 }
175173}
Original file line number Diff line number Diff line change @@ -29,7 +29,8 @@ namespace gameanalytics
2929
3030 protected:
3131
32- static constexpr size_t MAX_FPS_COUNT = 120 + 1 ;
32+ static constexpr int MAX_FPS_VALUE = 120 ;
33+ static constexpr size_t MAX_FPS_COUNT = MAX_FPS_VALUE + 1 ;
3334 static constexpr size_t MAX_MEMORY_COUNT = 100 + 1 ;
3435
3536 static constexpr std::chrono::milliseconds MEMORY_TRACK_FREQ {5000 };
You can’t perform that action at this time.
0 commit comments