소스 검색

Fixed an overflow where the intermediate is greater than UINT16_MAX.

Michael Hope 4 년 전
부모
커밋
657e04fdd4
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      lib/timer.h

+ 1 - 1
lib/timer.h 파일 보기

@@ -40,7 +40,7 @@ class Timer {
40 40
     static const uint8_t Reserved = 0xFE;
41 41
 
42 42
     uint8_t to_ticks(int ms) {
43
-        return (HAL::TicksPerSecond * ms + 500) / 1000;
43
+        return ((uint32_t)HAL::TicksPerSecond * ms + 500) / 1000;
44 44
     }
45 45
 
46 46
     bool tick_internal(uint8_t reload = Stopped);