From abdfcd78dbc90d68dd3da7701119f41f70a0def0 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 7 May 2023 17:22:09 +0200 Subject: [PATCH] More MSVC compat details Signed-off-by: falkTX --- source/modules/water/memory/Atomic.h | 13 ++++++++----- source/modules/water/misc/Time.cpp | 10 +++++++++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/source/modules/water/memory/Atomic.h b/source/modules/water/memory/Atomic.h index b41a2675f..d9018f8f5 100644 --- a/source/modules/water/memory/Atomic.h +++ b/source/modules/water/memory/Atomic.h @@ -179,12 +179,15 @@ public: This is exposed publicly in case you need to manipulate it directly for performance reasons. */ - #if defined(_MSC_VER) - __declspec (align (8)) - #elif defined(CARLA_OS_64BIT) - __attribute__ ((aligned (8))) + #ifdef CARLA_OS_64BIT + #define WATER_ALIGN_SIZE 8 #else - __attribute__ ((aligned (4))) + #define WATER_ALIGN_SIZE 4 + #endif + #ifdef _MSC_VER + __declspec (align (WATER_ALIGN_SIZE)) + #else + __attribute__ ((aligned (WATER_ALIGN_SIZE))) #endif mutable volatile Type value; diff --git a/source/modules/water/misc/Time.cpp b/source/modules/water/misc/Time.cpp index e23c32ae2..4450f7553 100644 --- a/source/modules/water/misc/Time.cpp +++ b/source/modules/water/misc/Time.cpp @@ -32,7 +32,9 @@ # include #elif defined(CARLA_OS_WIN) # include -#else +#endif + +#ifndef _MSC_VER # include #endif @@ -124,9 +126,15 @@ Time Time::getCurrentTime() noexcept int64 Time::currentTimeMillis() noexcept { + #ifdef _MSC_VER + struct _timeb t; + _ftime_s (&t); + return ((int64) t.time) * 1000 + t.millitm; + #else struct timeval tv; gettimeofday (&tv, nullptr); return ((int64) tv.tv_sec) * 1000 + tv.tv_usec / 1000; + #endif } //==============================================================================