Browse Source

Replaced some uses of the no-longer-needed literal64Bit macro.

tags/2021-05-28
jules 12 years ago
parent
commit
5c59897ba6
6 changed files with 18 additions and 24 deletions
  1. +1
    -1
      modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp
  2. +8
    -14
      modules/juce_core/maths/juce_MathsFunctions.h
  3. +1
    -1
      modules/juce_core/maths/juce_Random.cpp
  4. +2
    -2
      modules/juce_core/native/juce_win32_Files.cpp
  5. +1
    -1
      modules/juce_core/threads/juce_Thread.cpp
  6. +5
    -5
      modules/juce_core/time/juce_Time.cpp

+ 1
- 1
modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp View File

@@ -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 */


+ 8
- 14
modules/juce_core/maths/juce_MathsFunctions.h View File

@@ -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. */


+ 1
- 1
modules/juce_core/maths/juce_Random.cpp View File

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


+ 2
- 2
modules/juce_core/native/juce_win32_Files.cpp View File

@@ -42,7 +42,7 @@ namespace WindowsFileHelpers
{
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
@@ -50,7 +50,7 @@ namespace WindowsFileHelpers
if (time <= 0)
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;
}


+ 1
- 1
modules/juce_core/threads/juce_Thread.cpp View File

@@ -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 <int>::testInteger (*this);


+ 5
- 5
modules/juce_core/time/juce_Time.cpp View File

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


Loading…
Cancel
Save