diff options
author | Nick Brassel <nick@tzarc.org> | 2025-02-28 09:23:04 +1100 |
---|---|---|
committer | Nick Brassel <nick@tzarc.org> | 2025-02-28 09:23:04 +1100 |
commit | a63fd7f01cdabd9ce85bb09ae2b573fd3b8e60aa (patch) | |
tree | 35d817580e5244d62a150a2d012f72906a610977 /platforms/timer.h | |
parent | 6d0e5728aa61b442885d48caf49d29e5c60e8197 (diff) | |
parent | cdb865cf60b17593f5c811c24a21d7b3030d8653 (diff) |
Merge remote-tracking branch 'upstream/develop'
Diffstat (limited to 'platforms/timer.h')
-rw-r--r-- | platforms/timer.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/platforms/timer.h b/platforms/timer.h index fb8ff6bc54..8a2ffd476b 100644 --- a/platforms/timer.h +++ b/platforms/timer.h @@ -24,10 +24,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <stdint.h> -#define TIMER_DIFF(a, b, max) ((max == UINT8_MAX) ? ((uint8_t)((a) - (b))) : ((max == UINT16_MAX) ? ((uint16_t)((a) - (b))) : ((max == UINT32_MAX) ? ((uint32_t)((a) - (b))) : ((a) >= (b) ? (a) - (b) : (max) + 1 - (b) + (a))))) -#define TIMER_DIFF_8(a, b) TIMER_DIFF(a, b, UINT8_MAX) -#define TIMER_DIFF_16(a, b) TIMER_DIFF(a, b, UINT16_MAX) -#define TIMER_DIFF_32(a, b) TIMER_DIFF(a, b, UINT32_MAX) +#define TIMER_DIFF_8(a, b) (uint8_t)((a) - (b)) +#define TIMER_DIFF_16(a, b) (uint16_t)((a) - (b)) +#define TIMER_DIFF_32(a, b) (uint32_t)((a) - (b)) #define TIMER_DIFF_RAW(a, b) TIMER_DIFF_8(a, b) #ifdef __cplusplus |