@@ -942,7 +942,7 @@ private: | |||||
const size_t bytesPerFrame = numChannels * bitsPerSample / 8; | const size_t bytesPerFrame = numChannels * bitsPerSample / 8; | ||||
uint64 audioDataSize = bytesPerFrame * lengthInSamples; | uint64 audioDataSize = bytesPerFrame * lengthInSamples; | ||||
const bool isRF64 = (bytesWritten >= literal64bit (0x100000000)); | |||||
const bool isRF64 = (bytesWritten >= 0x100000000LL); | |||||
const bool isWaveFmtEx = isRF64 || (numChannels > 2); | const bool isWaveFmtEx = isRF64 || (numChannels > 2); | ||||
int64 riffChunkSize = (int64) (4 /* 'RIFF' */ + 8 + 40 /* WAVEFORMATEX */ | int64 riffChunkSize = (int64) (4 /* 'RIFF' */ + 8 + 40 /* WAVEFORMATEX */ | ||||
@@ -55,27 +55,21 @@ typedef unsigned int uint32; | |||||
typedef __int64 int64; | typedef __int64 int64; | ||||
/** A platform-independent 64-bit unsigned integer type. */ | /** A platform-independent 64-bit unsigned integer type. */ | ||||
typedef unsigned __int64 uint64; | 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 | #else | ||||
/** A platform-independent 64-bit integer type. */ | /** A platform-independent 64-bit integer type. */ | ||||
typedef long long int64; | typedef long long int64; | ||||
/** A platform-independent 64-bit unsigned integer type. */ | /** A platform-independent 64-bit unsigned integer type. */ | ||||
typedef unsigned long long uint64; | 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 | #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 | #if JUCE_64BIT | ||||
/** A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it. */ | /** A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it. */ | ||||
@@ -72,7 +72,7 @@ Random& Random::getSystemRandom() noexcept | |||||
//============================================================================== | //============================================================================== | ||||
int Random::nextInt() noexcept | int Random::nextInt() noexcept | ||||
{ | { | ||||
seed = (seed * literal64bit (0x5deece66d) + 11) & literal64bit (0xffffffffffff); | |||||
seed = (seed * 0x5deece66dLL + 11) & 0xffffffffffffLL; | |||||
return (int) (seed >> 16); | return (int) (seed >> 16); | ||||
} | } | ||||
@@ -42,7 +42,7 @@ namespace WindowsFileHelpers | |||||
{ | { | ||||
static_jassert (sizeof (ULARGE_INTEGER) == sizeof (FILETIME)); // tell me if this fails! | static_jassert (sizeof (ULARGE_INTEGER) == sizeof (FILETIME)); // tell me if this fails! | ||||
return (int64) ((reinterpret_cast<const ULARGE_INTEGER*> (ft)->QuadPart - literal64bit (116444736000000000)) / 10000); | |||||
return (int64) ((reinterpret_cast<const ULARGE_INTEGER*> (ft)->QuadPart - 116444736000000000LL) / 10000); | |||||
} | } | ||||
FILETIME* timeToFileTime (const int64 time, FILETIME* const ft) noexcept | FILETIME* timeToFileTime (const int64 time, FILETIME* const ft) noexcept | ||||
@@ -50,7 +50,7 @@ namespace WindowsFileHelpers | |||||
if (time <= 0) | if (time <= 0) | ||||
return nullptr; | return nullptr; | ||||
reinterpret_cast<ULARGE_INTEGER*> (ft)->QuadPart = (ULONGLONG) (time * 10000 + literal64bit (116444736000000000)); | |||||
reinterpret_cast<ULARGE_INTEGER*> (ft)->QuadPart = (ULONGLONG) (time * 10000 + 116444736000000000LL); | |||||
return ft; | return ft; | ||||
} | } | ||||
@@ -276,7 +276,7 @@ public: | |||||
expect (ByteOrder::swap ((uint16) 0x1122) == 0x2211); | expect (ByteOrder::swap ((uint16) 0x1122) == 0x2211); | ||||
expect (ByteOrder::swap ((uint32) 0x11223344) == 0x44332211); | expect (ByteOrder::swap ((uint32) 0x11223344) == 0x44332211); | ||||
expect (ByteOrder::swap ((uint64) literal64bit (0x1122334455667788)) == literal64bit (0x8877665544332211)); | |||||
expect (ByteOrder::swap ((uint64) 0x1122334455667788ULL) == 0x8877665544332211LL); | |||||
beginTest ("Atomic int"); | beginTest ("Atomic int"); | ||||
AtomicTester <int>::testInteger (*this); | AtomicTester <int>::testInteger (*this); | ||||
@@ -33,13 +33,13 @@ namespace TimeHelpers | |||||
struct tm result; | struct tm result; | ||||
const int64 seconds = millis / 1000; | 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.. | // use extended maths for dates beyond 1970 to 2037.. | ||||
const int timeZoneAdjustment = 31536000 - (int) (Time (1971, 0, 1, 0, 0).toMilliseconds() / 1000); | 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 a = 32044 + days; | ||||
const int b = (4 * a + 3) / 146097; | const int b = (4 * a + 3) / 146097; | ||||
const int c = a - (b * 146097) / 4; | const int c = a - (b * 146097) / 4; | ||||
@@ -53,7 +53,7 @@ namespace TimeHelpers | |||||
result.tm_wday = (days + 1) % 7; | result.tm_wday = (days + 1) % 7; | ||||
result.tm_yday = -1; | result.tm_yday = -1; | ||||
int t = (int) (jdm % literal64bit (86400)); | |||||
int t = (int) (jdm % 86400LL); | |||||
result.tm_hour = t / 3600; | result.tm_hour = t / 3600; | ||||
t %= 3600; | t %= 3600; | ||||
result.tm_min = t / 60; | result.tm_min = t / 60; | ||||
@@ -157,7 +157,7 @@ Time::Time (const int year, | |||||
+ (y * 365) + (y / 4) - (y / 100) + (y / 400) | + (y * 365) + (y / 4) - (y / 100) + (y / 400) | ||||
- 32045; | - 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)) | millisSinceEpoch = 1000 * (s + (hours * 3600 + minutes * 60 + seconds - timeZoneAdjustment)) | ||||
+ milliseconds; | + milliseconds; | ||||