diff --git a/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp index a6a9269dfd..406fa34be1 100644 --- a/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp @@ -942,7 +942,7 @@ private: const size_t bytesPerFrame = numChannels * bitsPerSample / 8; uint64 audioDataSize = bytesPerFrame * lengthInSamples; - const bool isRF64 = (bytesWritten >= literal64bit (0x100000000)); + const bool isRF64 = (bytesWritten >= 0x100000000LL); const bool isWaveFmtEx = isRF64 || (numChannels > 2); int64 riffChunkSize = (int64) (4 /* 'RIFF' */ + 8 + 40 /* WAVEFORMATEX */ diff --git a/modules/juce_core/maths/juce_MathsFunctions.h b/modules/juce_core/maths/juce_MathsFunctions.h index d365f55e3d..34d2f07f40 100644 --- a/modules/juce_core/maths/juce_MathsFunctions.h +++ b/modules/juce_core/maths/juce_MathsFunctions.h @@ -55,27 +55,21 @@ typedef unsigned int uint32; typedef __int64 int64; /** A platform-independent 64-bit unsigned integer type. */ typedef unsigned __int64 uint64; - /** A platform-independent macro for writing 64-bit literals, needed because - different compilers have different syntaxes for this. - - E.g. writing literal64bit (0x1000000000) will translate to 0x1000000000LL for - GCC, or 0x1000000000 for MSVC. - */ - #define literal64bit(longLiteral) ((__int64) longLiteral) #else /** A platform-independent 64-bit integer type. */ typedef long long int64; /** A platform-independent 64-bit unsigned integer type. */ typedef unsigned long long uint64; - /** A platform-independent macro for writing 64-bit literals, needed because - different compilers have different syntaxes for this. - - E.g. writing literal64bit (0x1000000000) will translate to 0x1000000000LL for - GCC, or 0x1000000000 for MSVC. - */ - #define literal64bit(longLiteral) (longLiteral##LL) #endif +#ifndef DOXYGEN + /** A macro for creating 64-bit literals. + Historically, this was needed to support portability with MSVC6, and is kept here + so that old code will still compile, but nowadays every compiler will support the + LL and ULL suffixes, so you should use those in preference to this macro. + */ + #define literal64bit(longLiteral) (longLiteral##LL) +#endif #if JUCE_64BIT /** A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it. */ diff --git a/modules/juce_core/maths/juce_Random.cpp b/modules/juce_core/maths/juce_Random.cpp index a884f67043..bb5c71d2b3 100644 --- a/modules/juce_core/maths/juce_Random.cpp +++ b/modules/juce_core/maths/juce_Random.cpp @@ -72,7 +72,7 @@ Random& Random::getSystemRandom() noexcept //============================================================================== int Random::nextInt() noexcept { - seed = (seed * literal64bit (0x5deece66d) + 11) & literal64bit (0xffffffffffff); + seed = (seed * 0x5deece66dLL + 11) & 0xffffffffffffLL; return (int) (seed >> 16); } diff --git a/modules/juce_core/native/juce_win32_Files.cpp b/modules/juce_core/native/juce_win32_Files.cpp index dbc8d46f3e..61015f603c 100644 --- a/modules/juce_core/native/juce_win32_Files.cpp +++ b/modules/juce_core/native/juce_win32_Files.cpp @@ -42,7 +42,7 @@ namespace WindowsFileHelpers { static_jassert (sizeof (ULARGE_INTEGER) == sizeof (FILETIME)); // tell me if this fails! - return (int64) ((reinterpret_cast (ft)->QuadPart - literal64bit (116444736000000000)) / 10000); + return (int64) ((reinterpret_cast (ft)->QuadPart - 116444736000000000LL) / 10000); } FILETIME* timeToFileTime (const int64 time, FILETIME* const ft) noexcept @@ -50,7 +50,7 @@ namespace WindowsFileHelpers if (time <= 0) return nullptr; - reinterpret_cast (ft)->QuadPart = (ULONGLONG) (time * 10000 + literal64bit (116444736000000000)); + reinterpret_cast (ft)->QuadPart = (ULONGLONG) (time * 10000 + 116444736000000000LL); return ft; } diff --git a/modules/juce_core/threads/juce_Thread.cpp b/modules/juce_core/threads/juce_Thread.cpp index 0f0504a596..20d25398d8 100644 --- a/modules/juce_core/threads/juce_Thread.cpp +++ b/modules/juce_core/threads/juce_Thread.cpp @@ -276,7 +276,7 @@ public: expect (ByteOrder::swap ((uint16) 0x1122) == 0x2211); expect (ByteOrder::swap ((uint32) 0x11223344) == 0x44332211); - expect (ByteOrder::swap ((uint64) literal64bit (0x1122334455667788)) == literal64bit (0x8877665544332211)); + expect (ByteOrder::swap ((uint64) 0x1122334455667788ULL) == 0x8877665544332211LL); beginTest ("Atomic int"); AtomicTester ::testInteger (*this); diff --git a/modules/juce_core/time/juce_Time.cpp b/modules/juce_core/time/juce_Time.cpp index 6344170003..b83b4a75ce 100644 --- a/modules/juce_core/time/juce_Time.cpp +++ b/modules/juce_core/time/juce_Time.cpp @@ -33,13 +33,13 @@ namespace TimeHelpers struct tm result; const int64 seconds = millis / 1000; - if (seconds < literal64bit (86400) || seconds >= literal64bit (2145916800)) + if (seconds < 86400LL || seconds >= 2145916800LL) { // use extended maths for dates beyond 1970 to 2037.. const int timeZoneAdjustment = 31536000 - (int) (Time (1971, 0, 1, 0, 0).toMilliseconds() / 1000); - const int64 jdm = seconds + timeZoneAdjustment + literal64bit (210866803200); + const int64 jdm = seconds + timeZoneAdjustment + 210866803200LL; - const int days = (int) (jdm / literal64bit (86400)); + const int days = (int) (jdm / 86400LL); const int a = 32044 + days; const int b = (4 * a + 3) / 146097; const int c = a - (b * 146097) / 4; @@ -53,7 +53,7 @@ namespace TimeHelpers result.tm_wday = (days + 1) % 7; result.tm_yday = -1; - int t = (int) (jdm % literal64bit (86400)); + int t = (int) (jdm % 86400LL); result.tm_hour = t / 3600; t %= 3600; result.tm_min = t / 60; @@ -157,7 +157,7 @@ Time::Time (const int year, + (y * 365) + (y / 4) - (y / 100) + (y / 400) - 32045; - const int64 s = ((int64) jd) * literal64bit (86400) - literal64bit (210866803200); + const int64 s = ((int64) jd) * 86400LL - 210866803200LL; millisSinceEpoch = 1000 * (s + (hours * 3600 + minutes * 60 + seconds - timeZoneAdjustment)) + milliseconds;