From 26df3579a3cc80a883ec1cf77a77d34913f3e1ac Mon Sep 17 00:00:00 2001 From: Quantum Date: Tue, 20 Jul 2021 18:38:01 -0400 Subject: [PATCH] [host] windows/delay: cast to LONGLONG instead of int The type of the QuadPart member of the LARGE_INTEGER union is actually LONGLONG, so we should cast to LONGLONG instead of int. This avoids truncation should (ms * 10000.0f) exceed 2^31-1. --- host/platform/Windows/src/delay.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/host/platform/Windows/src/delay.c b/host/platform/Windows/src/delay.c index 92eefc70..8015f948 100644 --- a/host/platform/Windows/src/delay.c +++ b/host/platform/Windows/src/delay.c @@ -41,6 +41,6 @@ void delayInit(void) void delayExecution(float ms) { - LARGE_INTEGER interval = { .QuadPart = -1 * (int)(ms * 10000.0f) }; + LARGE_INTEGER interval = { .QuadPart = -1 * (LONGLONG)(ms * 10000.0f) }; NtDelayExecution(FALSE, &interval); }