Browse Source

More MSVC compat details

Signed-off-by: falkTX <falktx@falktx.com>
pull/1775/head
falkTX 2 years ago
parent
commit
abdfcd78db
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 17 additions and 6 deletions
  1. +8
    -5
      source/modules/water/memory/Atomic.h
  2. +9
    -1
      source/modules/water/misc/Time.cpp

+ 8
- 5
source/modules/water/memory/Atomic.h View File

@@ -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;


+ 9
- 1
source/modules/water/misc/Time.cpp View File

@@ -32,7 +32,9 @@
# include <mach/mach_time.h>
#elif defined(CARLA_OS_WIN)
# include <mmsystem.h>
#else
#endif
#ifndef _MSC_VER
# include <sys/time.h>
#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
}
//==============================================================================


Loading…
Cancel
Save