- removed some long longs, to reduce that type's use to the necessary minimum

.
This commit is contained in:
Christoph Oelckers 2017-03-09 20:05:22 +01:00
parent d2beacfc5f
commit a17685f3fd
5 changed files with 24 additions and 24 deletions

View file

@ -85,7 +85,7 @@ void gl_CalculateCPUSpeed ()
{ {
LARGE_INTEGER count1, count2; LARGE_INTEGER count1, count2;
unsigned minDiff; unsigned minDiff;
long long ClockCalibration = 0; int64_t ClockCalibration = 0;
// Count cycles for at least 55 milliseconds. // Count cycles for at least 55 milliseconds.
// The performance counter is very low resolution compared to CPU // The performance counter is very low resolution compared to CPU

View file

@ -12,7 +12,7 @@ extern double gl_MillisecPerCycle;
#ifdef _MSC_VER #ifdef _MSC_VER
__forceinline long long GetClockCycle () __forceinline int64_t GetClockCycle ()
{ {
#if _M_X64 #if _M_X64
return __rdtsc(); return __rdtsc();
@ -23,18 +23,18 @@ __forceinline long long GetClockCycle ()
#elif defined __APPLE__ && (defined __i386__ || defined __x86_64__) #elif defined __APPLE__ && (defined __i386__ || defined __x86_64__)
inline long long GetClockCycle() inline int64_t GetClockCycle()
{ {
return __builtin_ia32_rdtsc(); return __builtin_ia32_rdtsc();
} }
#elif defined(__GNUG__) && defined(__i386__) #elif defined(__GNUG__) && defined(__i386__)
inline long long GetClockCycle() inline int64_t GetClockCycle()
{ {
if (CPU.bRDTSC) if (CPU.bRDTSC)
{ {
long long res; int64_t res;
asm volatile ("rdtsc" : "=A" (res)); asm volatile ("rdtsc" : "=A" (res));
return res; return res;
} }
@ -46,7 +46,7 @@ inline long long GetClockCycle()
#else #else
inline long long GetClockCycle () inline int64_t GetClockCycle ()
{ {
return 0; return 0;
} }
@ -71,13 +71,13 @@ public:
// Not using QueryPerformanceCounter directly, so we don't need // Not using QueryPerformanceCounter directly, so we don't need
// to pull in the Windows headers for every single file that // to pull in the Windows headers for every single file that
// wants to do some profiling. // wants to do some profiling.
long long time = (gl_benching? GetClockCycle() : 0); int64_t time = (gl_benching? GetClockCycle() : 0);
Counter -= time; Counter -= time;
} }
__forceinline void Unclock() __forceinline void Unclock()
{ {
long long time = (gl_benching? GetClockCycle() : 0); int64_t time = (gl_benching? GetClockCycle() : 0);
Counter += time; Counter += time;
} }
@ -92,7 +92,7 @@ public:
} }
private: private:
long long Counter; int64_t Counter;
}; };
extern glcycle_t RenderWall,SetupWall,ClipWall; extern glcycle_t RenderWall,SetupWall,ClipWall;

View file

@ -2159,7 +2159,7 @@ FISoundChannel *FMODSoundRenderer::StartSound3D(SoundHandle sfx, SoundListener *
void FMODSoundRenderer::MarkStartTime(FISoundChannel *chan) void FMODSoundRenderer::MarkStartTime(FISoundChannel *chan)
{ {
#if FMOD_STUDIO #if FMOD_STUDIO
unsigned long long int dsp_time; uint64_t dsp_time;
((FMOD::Channel *)chan->SysChannel)->getDSPClock(&dsp_time,NULL); ((FMOD::Channel *)chan->SysChannel)->getDSPClock(&dsp_time,NULL);
chan->StartTime.Lo = dsp_time & 0xFFFFFFFF; chan->StartTime.Lo = dsp_time & 0xFFFFFFFF;
chan->StartTime.Hi = dsp_time >> 32; chan->StartTime.Hi = dsp_time >> 32;
@ -2186,7 +2186,7 @@ bool FMODSoundRenderer::HandleChannelDelay(FMOD::Channel *chan, FISoundChannel *
// it would be in now if it had never been evicted. // it would be in now if it had never been evicted.
QWORD_UNION nowtime; QWORD_UNION nowtime;
#if FMOD_STUDIO #if FMOD_STUDIO
unsigned long long int delay; uint64_t delay;
chan->getDelay(&delay,NULL,NULL); chan->getDelay(&delay,NULL,NULL);
nowtime.Lo = delay & 0xFFFFFFFF; nowtime.Lo = delay & 0xFFFFFFFF;
nowtime.Hi = delay >> 32; nowtime.Hi = delay >> 32;
@ -2332,7 +2332,7 @@ FISoundChannel *FMODSoundRenderer::CommonChannelSetup(FMOD::Channel *chan, FISou
{ {
schan = S_GetChannel(chan); schan = S_GetChannel(chan);
#if FMOD_STUDIO #if FMOD_STUDIO
unsigned long long int time; uint64_t time;
chan->getDelay(&time,NULL,NULL); chan->getDelay(&time,NULL,NULL);
schan->StartTime.Lo = time & 0xFFFFFFFF; schan->StartTime.Lo = time & 0xFFFFFFFF;
schan->StartTime.Hi = time >> 32; schan->StartTime.Hi = time >> 32;
@ -2701,7 +2701,7 @@ void FMODSoundRenderer::Sync(bool sync)
{ {
Sys->lockDSP(); Sys->lockDSP();
#if FMOD_STUDIO #if FMOD_STUDIO
unsigned long long int clock; uint64_t clock;
SfxGroup->getDSPClock(&clock,NULL); SfxGroup->getDSPClock(&clock,NULL);
DSPClock.Lo = clock & 0xFFFFFFFF; DSPClock.Lo = clock & 0xFFFFFFFF;
DSPClock.Hi = clock >> 32; DSPClock.Hi = clock >> 32;
@ -2726,7 +2726,7 @@ void FMODSoundRenderer::UpdateSounds()
// Any sounds played between now and the next call to this function // Any sounds played between now and the next call to this function
// will start exactly one tic from now. // will start exactly one tic from now.
#if FMOD_STUDIO #if FMOD_STUDIO
unsigned long long int clock; uint64_t clock;
SfxGroup->getDSPClock(&clock,NULL); SfxGroup->getDSPClock(&clock,NULL);
DSPClock.Lo = clock & 0xFFFFFFFF; DSPClock.Lo = clock & 0xFFFFFFFF;
DSPClock.Hi = clock >> 32; DSPClock.Hi = clock >> 32;

View file

@ -124,16 +124,16 @@ inline unsigned __int64 rdtsc()
return 0; return 0;
} }
#else #else
inline unsigned long long rdtsc() inline uint64_t rdtsc()
{ {
#ifdef __amd64__ #ifdef __amd64__
unsigned long long tsc; uint64_t tsc;
asm volatile ("rdtsc; shlq $32, %%rdx; orq %%rdx, %%rax" : "=a" (tsc) :: "%rdx"); asm volatile ("rdtsc; shlq $32, %%rdx; orq %%rdx, %%rax" : "=a" (tsc) :: "%rdx");
return tsc; return tsc;
#else // i386 #else // i386
if (CPU.bRDTSC) if (CPU.bRDTSC)
{ {
unsigned long long tsc; uint64_t tsc;
asm volatile ("\trdtsc\n" : "=A" (tsc)); asm volatile ("\trdtsc\n" : "=A" (tsc));
return tsc; return tsc;
} }
@ -158,13 +158,13 @@ public:
void Clock() void Clock()
{ {
long long time = rdtsc(); int64_t time = rdtsc();
Counter -= time; Counter -= time;
} }
void Unclock() void Unclock()
{ {
long long time = rdtsc(); int64_t time = rdtsc();
Counter += time; Counter += time;
} }
@ -178,13 +178,13 @@ public:
return Counter * PerfToMillisec; return Counter * PerfToMillisec;
} }
long long GetRawCounter() int64_t GetRawCounter()
{ {
return Counter; return Counter;
} }
private: private:
long long Counter; int64_t Counter;
}; };
#endif #endif

View file

@ -285,14 +285,14 @@ void DoBlending_SSE2(const PalEntry *from, PalEntry *to, int count, int r, int g
unaligned = ((size_t)from | (size_t)to) & 0xF; unaligned = ((size_t)from | (size_t)to) & 0xF;
#if defined(__amd64__) || defined(_M_X64) #if defined(__amd64__) || defined(_M_X64)
long long color; int64_t color;
blending256 = _mm_set_epi64x(0x10001000100ll, 0x10001000100ll); blending256 = _mm_set_epi64x(0x10001000100ll, 0x10001000100ll);
color = ((long long)r << 32) | (g << 16) | b; color = ((int64_t)r << 32) | (g << 16) | b;
blendcolor = _mm_set_epi64x(color, color); blendcolor = _mm_set_epi64x(color, color);
color = ((long long)a << 32) | (a << 16) | a; color = ((int64_t)a << 32) | (a << 16) | a;
blendalpha = _mm_set_epi64x(color, color); blendalpha = _mm_set_epi64x(color, color);
#else #else
int color; int color;