From ddf6987b5367c7d7399890c771f4a6f06d895744 Mon Sep 17 00:00:00 2001 From: Tom Englund Date: Sun, 25 Aug 2024 17:48:53 +0200 Subject: [PATCH] backend: dont overflow on 32bit builds (#64) make the definition long long as its used as long long later, only the value was being calculated TIMESPEC_NSEC_PER_SEC * 240 and rolls over before assigning to the variable. --- src/backend/Backend.cpp | 2 +- src/backend/Headless.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/Backend.cpp b/src/backend/Backend.cpp index a6db06a..a16657a 100644 --- a/src/backend/Backend.cpp +++ b/src/backend/Backend.cpp @@ -17,7 +17,7 @@ using namespace Hyprutils::Memory; using namespace Aquamarine; #define SP CSharedPointer -#define TIMESPEC_NSEC_PER_SEC 1000000000L +#define TIMESPEC_NSEC_PER_SEC 1000000000LL static void timespecAddNs(timespec* pTimespec, int64_t delta) { int delta_ns_low = delta % TIMESPEC_NSEC_PER_SEC; diff --git a/src/backend/Headless.cpp b/src/backend/Headless.cpp index df4b312..55a8617 100644 --- a/src/backend/Headless.cpp +++ b/src/backend/Headless.cpp @@ -10,7 +10,7 @@ using namespace Hyprutils::Memory; using namespace Hyprutils::Math; #define SP CSharedPointer -#define TIMESPEC_NSEC_PER_SEC 1000000000L +#define TIMESPEC_NSEC_PER_SEC 1000000000LL static void timespecAddNs(timespec* pTimespec, int64_t delta) { int delta_ns_low = delta % TIMESPEC_NSEC_PER_SEC;