mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Merge pull request #2058 from Stevoisiak/Codemaid-Cleanup-Take2
Basic Formatting/Whitespace Cleanup
This commit is contained in:
@@ -17,7 +17,7 @@ namespace AudioCommon
|
||||
SoundStream* InitSoundStream();
|
||||
void ShutdownSoundStream();
|
||||
std::vector<std::string> GetSoundBackends();
|
||||
void PauseAndLock(bool doLock, bool unpauseOnUnlock=true);
|
||||
void PauseAndLock(bool doLock, bool unpauseOnUnlock = true);
|
||||
void UpdateSoundStream();
|
||||
void ClearAudioBuffer(bool mute);
|
||||
void SendAIBuffer(short* samples, unsigned int num_samples);
|
||||
|
||||
@@ -80,9 +80,9 @@ static T FIRFilter(const T *buf, int pos, int len, int count, const float *coeff
|
||||
// high part of window
|
||||
const T *ptr = &buf[pos];
|
||||
|
||||
float r1=DotProduct(count1,ptr,coefficients);coefficients+=count1;
|
||||
float r2=DotProduct(count2,buf,coefficients);
|
||||
return T(r1+r2);
|
||||
float r1 = DotProduct(count1, ptr, coefficients); coefficients += count1;
|
||||
float r2 = DotProduct(count2, buf, coefficients);
|
||||
return T(r1 + r2);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -96,7 +96,7 @@ static T FIRFilter(const T *buf, int pos, int len, int count, const float *coeff
|
||||
*/
|
||||
static void Hamming(int n, float* w)
|
||||
{
|
||||
float k = float(2*M_PI/((float)(n-1))); // 2*pi/(N-1)
|
||||
float k = float(2*M_PI/((float)(n - 1))); // 2*pi/(N-1)
|
||||
|
||||
// Calculate window coefficients
|
||||
for (int i = 0; i < n; i++)
|
||||
@@ -122,27 +122,28 @@ returns 0 if OK, -1 if fail
|
||||
*/
|
||||
static float* DesignFIR(unsigned int *n, float* fc, float opt)
|
||||
{
|
||||
unsigned int o = *n & 1; // Indicator for odd filter length
|
||||
unsigned int o = *n & 1; // Indicator for odd filter length
|
||||
unsigned int end = ((*n + 1) >> 1) - o; // Loop end
|
||||
|
||||
float k1 = 2 * float(M_PI); // 2*pi*fc1
|
||||
float k2 = 0.5f * (float)(1 - o); // Constant used if the filter has even length
|
||||
float g = 0.0f; // Gain
|
||||
float g = 0.0f; // Gain
|
||||
float t1; // Temporary variables
|
||||
float fc1; // Cutoff frequencies
|
||||
|
||||
// Sanity check
|
||||
if (*n==0) return nullptr;
|
||||
MathUtil::Clamp(&fc[0],float(0.001),float(1));
|
||||
if (*n == 0)
|
||||
return nullptr;
|
||||
MathUtil::Clamp(&fc[0], float(0.001), float(1));
|
||||
|
||||
float *w=(float*)calloc(sizeof(float),*n);
|
||||
float *w = (float*)calloc(sizeof(float), *n);
|
||||
|
||||
// Get window coefficients
|
||||
Hamming(*n,w);
|
||||
Hamming(*n, w);
|
||||
|
||||
fc1=*fc;
|
||||
fc1 = *fc;
|
||||
// Cutoff frequency must be < 0.5 where 0.5 <=> Fs/2
|
||||
fc1 = ((fc1 <= 1.0) && (fc1 > 0.0)) ? fc1/2 : 0.25f;
|
||||
fc1 = ((fc1 <= 1.0) && (fc1 > 0.0)) ? fc1 / 2 : 0.25f;
|
||||
k1 *= fc1;
|
||||
|
||||
// Low pass filter
|
||||
@@ -154,20 +155,20 @@ static float* DesignFIR(unsigned int *n, float* fc, float opt)
|
||||
if (o)
|
||||
{
|
||||
w[end] = fc1 * w[end] * 2.0f;
|
||||
g=w[end];
|
||||
g = w[end];
|
||||
}
|
||||
|
||||
// Create filter
|
||||
for (u32 i = 0; i < end; i++)
|
||||
{
|
||||
t1 = (float)(i+1) - k2;
|
||||
w[end-i-1] = w[*n-end+i] = float(w[end-i-1] * sin(k1 * t1)/(M_PI * t1)); // Sinc
|
||||
g += 2*w[end-i-1]; // Total gain in filter
|
||||
t1 = (float)(i + 1) - k2;
|
||||
w[end - i - 1] = w[*n - end + i] = float(w[end - i - 1] * sin(k1 * t1)/(M_PI * t1)); // Sinc
|
||||
g += 2*w[end - i - 1]; // Total gain in filter
|
||||
}
|
||||
|
||||
|
||||
// Normalize gain
|
||||
g=1/g;
|
||||
g = 1/g;
|
||||
for (u32 i = 0; i < *n; i++)
|
||||
w[i] *= g;
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ void OpenALStream::SoundLoop()
|
||||
ALint iBuffersFilled = 0;
|
||||
ALint iBuffersProcessed = 0;
|
||||
ALint iState = 0;
|
||||
ALuint uiBufferTemp[OAL_MAX_BUFFERS] = {0};
|
||||
ALuint uiBufferTemp[OAL_MAX_BUFFERS] = { 0 };
|
||||
|
||||
soundTouch.setChannels(2);
|
||||
soundTouch.setSampleRate(ulFrequency);
|
||||
@@ -255,7 +255,7 @@ void OpenALStream::SoundLoop()
|
||||
// good 5.0 but not a good 5.1 output. Sadly there is not a 5.0
|
||||
// AL_FORMAT_50CHN32 to make this super-explicit.
|
||||
// DPL2Decode output: LEFTFRONT, RIGHTFRONT, CENTREFRONT, (sub), LEFTREAR, RIGHTREAR
|
||||
for (u32 i=0; i < nSamples; ++i)
|
||||
for (u32 i = 0; i < nSamples; ++i)
|
||||
{
|
||||
dpl2[i*SURROUND_CHANNELS + 3 /*sub/lfe*/] = 0.0f;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
virtual bool Start() override;
|
||||
virtual void Stop() override;
|
||||
|
||||
static bool isValid() {return true;}
|
||||
static bool isValid() { return true; }
|
||||
|
||||
virtual void Update() override;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
|
||||
enum {BUF_SIZE = 32*1024};
|
||||
enum { BUF_SIZE = 32*1024 };
|
||||
|
||||
WaveFileWriter::WaveFileWriter():
|
||||
skip_silence(false),
|
||||
@@ -19,7 +19,7 @@ WaveFileWriter::WaveFileWriter():
|
||||
|
||||
WaveFileWriter::~WaveFileWriter()
|
||||
{
|
||||
delete [] conv_buffer;
|
||||
delete[] conv_buffer;
|
||||
Stop();
|
||||
}
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ public:
|
||||
BitField() = default;
|
||||
|
||||
#ifndef _WIN32
|
||||
// We explicitly delete the copy assigment operator here, because the
|
||||
// We explicitly delete the copy assignment operator here, because the
|
||||
// default copy assignment would copy the full storage value, rather than
|
||||
// just the bits relevant to this particular bit field.
|
||||
// Ideally, we would just implement the copy assignment to copy only the
|
||||
@@ -183,7 +183,7 @@ private:
|
||||
|
||||
__forceinline StorageType GetMask() const
|
||||
{
|
||||
return ((~(StorageTypeU)0) >> (8*sizeof(T) - bits)) << position;
|
||||
return ((~(StorageTypeU)0) >> (8 * sizeof(T) - bits)) << position;
|
||||
}
|
||||
|
||||
StorageType storage;
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
bool IsTempBreakPoint(u32 _iAddress);
|
||||
|
||||
// Add BreakPoint
|
||||
void Add(u32 em_address, bool temp=false);
|
||||
void Add(u32 em_address, bool temp = false);
|
||||
void Add(const TBreakPoint& bp);
|
||||
|
||||
// Remove Breakpoint
|
||||
|
||||
@@ -72,23 +72,23 @@ std::vector<std::string> cdio_get_devices()
|
||||
CFMutableDictionaryRef classes_to_match;
|
||||
std::vector<std::string> drives;
|
||||
|
||||
kern_result = IOMasterPort( MACH_PORT_NULL, &master_port );
|
||||
kern_result = IOMasterPort(MACH_PORT_NULL, &master_port);
|
||||
if (kern_result != KERN_SUCCESS)
|
||||
return( drives );
|
||||
return drives;
|
||||
|
||||
classes_to_match = IOServiceMatching( kIOCDMediaClass );
|
||||
classes_to_match = IOServiceMatching(kIOCDMediaClass);
|
||||
if (classes_to_match == nullptr)
|
||||
return( drives );
|
||||
return drives;
|
||||
|
||||
CFDictionarySetValue( classes_to_match,
|
||||
CFSTR(kIOMediaEjectableKey), kCFBooleanTrue );
|
||||
CFDictionarySetValue(classes_to_match,
|
||||
CFSTR(kIOMediaEjectableKey), kCFBooleanTrue);
|
||||
|
||||
kern_result = IOServiceGetMatchingServices( master_port,
|
||||
classes_to_match, &media_iterator );
|
||||
kern_result = IOServiceGetMatchingServices(master_port,
|
||||
classes_to_match, &media_iterator);
|
||||
if (kern_result != KERN_SUCCESS)
|
||||
return( drives );
|
||||
return drives;
|
||||
|
||||
next_media = IOIteratorNext( media_iterator );
|
||||
next_media = IOIteratorNext(media_iterator);
|
||||
if (next_media != 0)
|
||||
{
|
||||
CFTypeRef str_bsd_path;
|
||||
@@ -96,12 +96,12 @@ std::vector<std::string> cdio_get_devices()
|
||||
do
|
||||
{
|
||||
str_bsd_path =
|
||||
IORegistryEntryCreateCFProperty( next_media,
|
||||
CFSTR( kIOBSDNameKey ), kCFAllocatorDefault,
|
||||
0 );
|
||||
IORegistryEntryCreateCFProperty(next_media,
|
||||
CFSTR(kIOBSDNameKey), kCFAllocatorDefault,
|
||||
0);
|
||||
if (str_bsd_path == nullptr)
|
||||
{
|
||||
IOObjectRelease( next_media );
|
||||
IOObjectRelease(next_media);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -120,12 +120,11 @@ std::vector<std::string> cdio_get_devices()
|
||||
|
||||
delete[] buf;
|
||||
}
|
||||
CFRelease( str_bsd_path );
|
||||
IOObjectRelease( next_media );
|
||||
|
||||
} while (( next_media = IOIteratorNext( media_iterator ) ) != 0);
|
||||
CFRelease(str_bsd_path);
|
||||
IOObjectRelease(next_media);
|
||||
} while ((next_media = IOIteratorNext(media_iterator)) != 0);
|
||||
}
|
||||
IOObjectRelease( media_iterator );
|
||||
IOObjectRelease(media_iterator);
|
||||
return drives;
|
||||
}
|
||||
#else
|
||||
@@ -166,11 +165,11 @@ static bool is_cdrom(const std::string& drive, char *mnttype)
|
||||
{
|
||||
// Check if the device exists
|
||||
if (!is_device(drive))
|
||||
return(false);
|
||||
return false;
|
||||
|
||||
bool is_cd=false;
|
||||
bool is_cd = false;
|
||||
// If it does exist, verify that it is a cdrom/dvd drive
|
||||
int cdfd = open(drive.c_str(), (O_RDONLY|O_NONBLOCK), 0);
|
||||
int cdfd = open(drive.c_str(), (O_RDONLY | O_NONBLOCK), 0);
|
||||
if (cdfd >= 0)
|
||||
{
|
||||
#ifdef __linux__
|
||||
@@ -179,11 +178,11 @@ static bool is_cdrom(const std::string& drive, char *mnttype)
|
||||
is_cd = true;
|
||||
close(cdfd);
|
||||
}
|
||||
return(is_cd);
|
||||
return is_cd;
|
||||
}
|
||||
|
||||
// Returns a pointer to an array of strings with the device names
|
||||
std::vector<std::string> cdio_get_devices ()
|
||||
std::vector<std::string> cdio_get_devices()
|
||||
{
|
||||
std::vector<std::string> drives;
|
||||
// Scan the system for DVD/CD-ROM drives.
|
||||
|
||||
@@ -161,7 +161,7 @@ public:
|
||||
}
|
||||
|
||||
template <typename T, std::size_t N>
|
||||
void DoArray(std::array<T,N>& x)
|
||||
void DoArray(std::array<T, N>& x)
|
||||
{
|
||||
DoArray(x.data(), (u32)x.size());
|
||||
}
|
||||
@@ -260,8 +260,7 @@ public:
|
||||
LinkedListItem<T>* next = list_cur->next;
|
||||
TFree(list_cur);
|
||||
list_cur = next;
|
||||
}
|
||||
while (list_cur);
|
||||
} while (list_cur);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -332,7 +331,7 @@ public:
|
||||
template<class T>
|
||||
static bool Load(const std::string& _rFilename, u32 _Revision, T& _class)
|
||||
{
|
||||
INFO_LOG(COMMON, "ChunkReader: Loading %s" , _rFilename.c_str());
|
||||
INFO_LOG(COMMON, "ChunkReader: Loading %s", _rFilename.c_str());
|
||||
|
||||
if (!File::Exists(_rFilename))
|
||||
return false;
|
||||
@@ -342,14 +341,14 @@ public:
|
||||
static const u64 headerSize = sizeof(SChunkHeader);
|
||||
if (fileSize < headerSize)
|
||||
{
|
||||
ERROR_LOG(COMMON,"ChunkReader: File too small");
|
||||
ERROR_LOG(COMMON, "ChunkReader: File too small");
|
||||
return false;
|
||||
}
|
||||
|
||||
File::IOFile pFile(_rFilename, "rb");
|
||||
if (!pFile)
|
||||
{
|
||||
ERROR_LOG(COMMON,"ChunkReader: Can't open file for reading");
|
||||
ERROR_LOG(COMMON, "ChunkReader: Can't open file for reading");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -357,14 +356,14 @@ public:
|
||||
SChunkHeader header;
|
||||
if (!pFile.ReadArray(&header, 1))
|
||||
{
|
||||
ERROR_LOG(COMMON,"ChunkReader: Bad header size");
|
||||
ERROR_LOG(COMMON, "ChunkReader: Bad header size");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check revision
|
||||
if (header.Revision != _Revision)
|
||||
{
|
||||
ERROR_LOG(COMMON,"ChunkReader: Wrong file revision, got %d expected %d",
|
||||
ERROR_LOG(COMMON, "ChunkReader: Wrong file revision, got %d expected %d",
|
||||
header.Revision, _Revision);
|
||||
return false;
|
||||
}
|
||||
@@ -373,7 +372,7 @@ public:
|
||||
const u32 sz = (u32)(fileSize - headerSize);
|
||||
if (header.ExpectedSize != sz)
|
||||
{
|
||||
ERROR_LOG(COMMON,"ChunkReader: Bad file size, got %d expected %d",
|
||||
ERROR_LOG(COMMON, "ChunkReader: Bad file size, got %d expected %d",
|
||||
sz, header.ExpectedSize);
|
||||
return false;
|
||||
}
|
||||
@@ -382,7 +381,7 @@ public:
|
||||
std::vector<u8> buffer(sz);
|
||||
if (!pFile.ReadArray(&buffer[0], sz))
|
||||
{
|
||||
ERROR_LOG(COMMON,"ChunkReader: Error reading file");
|
||||
ERROR_LOG(COMMON, "ChunkReader: Error reading file");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -390,7 +389,7 @@ public:
|
||||
PointerWrap p(&ptr, PointerWrap::MODE_READ);
|
||||
_class.DoState(p);
|
||||
|
||||
INFO_LOG(COMMON, "ChunkReader: Done loading %s" , _rFilename.c_str());
|
||||
INFO_LOG(COMMON, "ChunkReader: Done loading %s", _rFilename.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -398,11 +397,11 @@ public:
|
||||
template<class T>
|
||||
static bool Save(const std::string& _rFilename, u32 _Revision, T& _class)
|
||||
{
|
||||
INFO_LOG(COMMON, "ChunkReader: Writing %s" , _rFilename.c_str());
|
||||
INFO_LOG(COMMON, "ChunkReader: Writing %s", _rFilename.c_str());
|
||||
File::IOFile pFile(_rFilename, "wb");
|
||||
if (!pFile)
|
||||
{
|
||||
ERROR_LOG(COMMON,"ChunkReader: Error opening file for write");
|
||||
ERROR_LOG(COMMON, "ChunkReader: Error opening file for write");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -424,17 +423,17 @@ public:
|
||||
// Write to file
|
||||
if (!pFile.WriteArray(&header, 1))
|
||||
{
|
||||
ERROR_LOG(COMMON,"ChunkReader: Failed writing header");
|
||||
ERROR_LOG(COMMON, "ChunkReader: Failed writing header");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!pFile.WriteArray(&buffer[0], sz))
|
||||
{
|
||||
ERROR_LOG(COMMON,"ChunkReader: Failed writing data");
|
||||
ERROR_LOG(COMMON, "ChunkReader: Failed writing data");
|
||||
return false;
|
||||
}
|
||||
|
||||
INFO_LOG(COMMON,"ChunkReader: Done writing %s", _rFilename.c_str());
|
||||
INFO_LOG(COMMON, "ChunkReader: Done writing %s", _rFilename.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ void CFileSearch::FindFiles(const std::string& _searchString, const std::string&
|
||||
std::equal(end_match.rbegin(), end_match.rend(), found.rbegin()))
|
||||
{
|
||||
std::string full_name;
|
||||
if (_strPath.c_str()[_strPath.size()-1] == DIR_SEP_CHR)
|
||||
if (_strPath.c_str()[_strPath.size() - 1] == DIR_SEP_CHR)
|
||||
full_name = _strPath + found;
|
||||
else
|
||||
full_name = _strPath + DIR_SEP + found;
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
|
||||
~FixedSizeQueue()
|
||||
{
|
||||
delete [] storage;
|
||||
delete[] storage;
|
||||
}
|
||||
|
||||
void clear()
|
||||
|
||||
+46
-35
@@ -24,11 +24,11 @@ u32 HashFletcher(const u8* data_u8, size_t length)
|
||||
size_t tlen = len > 360 ? 360 : len;
|
||||
len -= tlen;
|
||||
|
||||
do {
|
||||
do
|
||||
{
|
||||
sum1 += *data++;
|
||||
sum2 += sum1;
|
||||
}
|
||||
while (--tlen);
|
||||
} while (--tlen);
|
||||
|
||||
sum1 = (sum1 & 0xffff) + (sum1 >> 16);
|
||||
sum2 = (sum2 & 0xffff) + (sum2 >> 16);
|
||||
@@ -58,8 +58,7 @@ u32 HashAdler32(const u8* data, size_t len)
|
||||
{
|
||||
a += *data++;
|
||||
b += a;
|
||||
}
|
||||
while (--tlen);
|
||||
} while (--tlen);
|
||||
|
||||
a = (a & 0xffff) + (a >> 16) * (65536 - MOD_ADLER);
|
||||
b = (b & 0xffff) + (b >> 16) * (65536 - MOD_ADLER);
|
||||
@@ -115,24 +114,24 @@ inline u64 getblock(const u64 * p, int i)
|
||||
inline void bmix64(u64 & h1, u64 & h2, u64 & k1, u64 & k2, u64 & c1, u64 & c2)
|
||||
{
|
||||
k1 *= c1;
|
||||
k1 = _rotl64(k1,23);
|
||||
k1 = _rotl64(k1, 23);
|
||||
k1 *= c2;
|
||||
h1 ^= k1;
|
||||
h1 += h2;
|
||||
|
||||
h2 = _rotl64(h2,41);
|
||||
h2 = _rotl64(h2, 41);
|
||||
|
||||
k2 *= c2;
|
||||
k2 = _rotl64(k2,23);
|
||||
k2 = _rotl64(k2, 23);
|
||||
k2 *= c1;
|
||||
h2 ^= k2;
|
||||
h2 += h1;
|
||||
|
||||
h1 = h1*3+0x52dce729;
|
||||
h2 = h2*3+0x38495ab5;
|
||||
h1 = h1 * 3 + 0x52dce729;
|
||||
h2 = h2 * 3 + 0x38495ab5;
|
||||
|
||||
c1 = c1*5+0x7b7d159c;
|
||||
c2 = c2*5+0x6bce6396;
|
||||
c1 = c1 * 5 + 0x7b7d159c;
|
||||
c2 = c2 * 5 + 0x6bce6396;
|
||||
}
|
||||
|
||||
//----------
|
||||
@@ -154,9 +153,11 @@ u64 GetMurmurHash3(const u8 *src, u32 len, u32 samples)
|
||||
const u8 * data = (const u8*)src;
|
||||
const int nblocks = len / 16;
|
||||
u32 Step = (len / 8);
|
||||
if (samples == 0) samples = std::max(Step, 1u);
|
||||
if (samples == 0)
|
||||
samples = std::max(Step, 1u);
|
||||
Step = Step / samples;
|
||||
if (Step < 1) Step = 1;
|
||||
if (Step < 1)
|
||||
Step = 1;
|
||||
|
||||
u64 h1 = 0x9368e53c2f6af274;
|
||||
u64 h2 = 0x586dcd208f7cd3fd;
|
||||
@@ -172,8 +173,8 @@ u64 GetMurmurHash3(const u8 *src, u32 len, u32 samples)
|
||||
|
||||
for (int i = 0; i < nblocks; i+=Step)
|
||||
{
|
||||
u64 k1 = getblock(blocks,i*2+0);
|
||||
u64 k2 = getblock(blocks,i*2+1);
|
||||
u64 k1 = getblock(blocks, i*2+0);
|
||||
u64 k2 = getblock(blocks, i*2+1);
|
||||
|
||||
bmix64(h1,h2,k1,k2,c1,c2);
|
||||
}
|
||||
@@ -232,9 +233,11 @@ u64 GetCRC32(const u8 *src, u32 len, u32 samples)
|
||||
u32 Step = (len / 8);
|
||||
const u64 *data = (const u64 *)src;
|
||||
const u64 *end = data + Step;
|
||||
if (samples == 0) samples = std::max(Step, 1u);
|
||||
if (samples == 0)
|
||||
samples = std::max(Step, 1u);
|
||||
Step = Step / samples;
|
||||
if (Step < 1) Step = 1;
|
||||
if (Step < 1)
|
||||
Step = 1;
|
||||
while (data < end - Step * 3)
|
||||
{
|
||||
h[0] = _mm_crc32_u64(h[0], data[Step * 0]);
|
||||
@@ -280,9 +283,11 @@ u64 GetHashHiresTexture(const u8 *src, u32 len, u32 samples)
|
||||
u32 Step = (len / 8);
|
||||
const u64 *data = (const u64 *)src;
|
||||
const u64 *end = data + Step;
|
||||
if (samples == 0) samples = std::max(Step, 1u);
|
||||
if (samples == 0)
|
||||
samples = std::max(Step, 1u);
|
||||
Step = Step / samples;
|
||||
if (Step < 1) Step = 1;
|
||||
if (Step < 1)
|
||||
Step = 1;
|
||||
while (data < end)
|
||||
{
|
||||
u64 k = data[0];
|
||||
@@ -323,9 +328,11 @@ u64 GetCRC32(const u8 *src, u32 len, u32 samples)
|
||||
u32 Step = (len/4);
|
||||
const u32 *data = (const u32 *)src;
|
||||
const u32 *end = data + Step;
|
||||
if (samples == 0) samples = std::max(Step, 1u);
|
||||
if (samples == 0)
|
||||
samples = std::max(Step, 1u);
|
||||
Step = Step / samples;
|
||||
if (Step < 1) Step = 1;
|
||||
if (Step < 1)
|
||||
Step = 1;
|
||||
while (data < end)
|
||||
{
|
||||
h = _mm_crc32_u32(h, data[0]);
|
||||
@@ -367,24 +374,24 @@ inline u32 fmix32(u32 h)
|
||||
inline void bmix32(u32 & h1, u32 & h2, u32 & k1, u32 & k2, u32 & c1, u32 & c2)
|
||||
{
|
||||
k1 *= c1;
|
||||
k1 = _rotl(k1,11);
|
||||
k1 = _rotl(k1, 11);
|
||||
k1 *= c2;
|
||||
h1 ^= k1;
|
||||
h1 += h2;
|
||||
|
||||
h2 = _rotl(h2,17);
|
||||
h2 = _rotl(h2, 17);
|
||||
|
||||
k2 *= c2;
|
||||
k2 = _rotl(k2,11);
|
||||
k2 = _rotl(k2, 11);
|
||||
k2 *= c1;
|
||||
h2 ^= k2;
|
||||
h2 += h1;
|
||||
|
||||
h1 = h1*3+0x52dce729;
|
||||
h2 = h2*3+0x38495ab5;
|
||||
h1 = h1*3+0x52dce729;
|
||||
h2 = h2*3+0x38495ab5;
|
||||
|
||||
c1 = c1*5+0x7b7d159c;
|
||||
c2 = c2*5+0x6bce6396;
|
||||
c1 = c1*5+0x7b7d159c;
|
||||
c2 = c2*5+0x6bce6396;
|
||||
}
|
||||
|
||||
//----------
|
||||
@@ -395,9 +402,11 @@ u64 GetMurmurHash3(const u8* src, u32 len, u32 samples)
|
||||
u32 out[2];
|
||||
const int nblocks = len / 8;
|
||||
u32 Step = (len / 4);
|
||||
if (samples == 0) samples = std::max(Step, 1u);
|
||||
if (samples == 0)
|
||||
samples = std::max(Step, 1u);
|
||||
Step = Step / samples;
|
||||
if (Step < 1) Step = 1;
|
||||
if (Step < 1)
|
||||
Step = 1;
|
||||
|
||||
u32 h1 = 0x8de1c3ac;
|
||||
u32 h2 = 0xbab98226;
|
||||
@@ -446,8 +455,8 @@ u64 GetMurmurHash3(const u8* src, u32 len, u32 samples)
|
||||
h1 += h2;
|
||||
h2 += h1;
|
||||
|
||||
h1 = fmix32(h1);
|
||||
h2 = fmix32(h2);
|
||||
h1 = fmix32(h1);
|
||||
h2 = fmix32(h2);
|
||||
|
||||
h1 += h2;
|
||||
h2 += h1;
|
||||
@@ -471,9 +480,11 @@ u64 GetHashHiresTexture(const u8 *src, u32 len, u32 samples)
|
||||
u32 Step = (len / 8);
|
||||
const u64 *data = (const u64 *)src;
|
||||
const u64 *end = data + Step;
|
||||
if (samples == 0) samples = std::max(Step, 1u);
|
||||
if (samples == 0)
|
||||
samples = std::max(Step, 1u);
|
||||
Step = Step / samples;
|
||||
if (Step < 1) Step = 1;
|
||||
if (Step < 1)
|
||||
Step = 1;
|
||||
while (data < end)
|
||||
{
|
||||
u64 k = data[0];
|
||||
|
||||
@@ -63,7 +63,6 @@ public:
|
||||
void Set(const std::string& key, bool newValue)
|
||||
{
|
||||
Set(key, StringFromBool(newValue));
|
||||
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
||||
@@ -41,7 +41,8 @@ void ConsoleListener::Open(bool Hidden, int Width, int Height, const char *Title
|
||||
// Open the console window and create the window handle for GetStdHandle()
|
||||
AllocConsole();
|
||||
// Hide
|
||||
if (Hidden) ShowWindow(GetConsoleWindow(), SW_HIDE);
|
||||
if (Hidden)
|
||||
ShowWindow(GetConsoleWindow(), SW_HIDE);
|
||||
// Save the window handle that AllocConsole() created
|
||||
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
// Set the console window title
|
||||
@@ -133,9 +134,9 @@ void ConsoleListener::LetterSpace(int Width, int Height)
|
||||
int NewScreenHeight = OldScreenHeight;
|
||||
|
||||
// Width
|
||||
BufferWidthHeight(NewBufferWidth, OldBufferHeight, NewScreenWidth, OldScreenHeight, (NewBufferWidth > OldScreenWidth-1));
|
||||
BufferWidthHeight(NewBufferWidth, OldBufferHeight, NewScreenWidth, OldScreenHeight, (NewBufferWidth > OldScreenWidth - 1));
|
||||
// Height
|
||||
BufferWidthHeight(NewBufferWidth, NewBufferHeight, NewScreenWidth, NewScreenHeight, (NewBufferHeight > OldScreenHeight-1));
|
||||
BufferWidthHeight(NewBufferWidth, NewBufferHeight, NewScreenWidth, NewScreenHeight, (NewBufferHeight > OldScreenHeight - 1));
|
||||
|
||||
// Resize the window too
|
||||
//MoveWindow(GetConsoleWindow(), 200,200, (Width*8 + 50),(NewScreenHeight*12 + 200), true);
|
||||
@@ -157,7 +158,8 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// Check size
|
||||
if (Width < 8 || Height < 12) return;
|
||||
if (Width < 8 || Height < 12)
|
||||
return;
|
||||
|
||||
bool DBef = true;
|
||||
bool DAft = true;
|
||||
@@ -233,10 +235,12 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool
|
||||
COORD Coo = GetCoordinates(OldCursor, LBufWidth);
|
||||
SetConsoleCursorPosition(hConsole, Coo);
|
||||
|
||||
if (SLog.length() > 0) Log(LogTypes::LNOTICE, SLog.c_str());
|
||||
if (SLog.length() > 0)
|
||||
Log(LogTypes::LNOTICE, SLog.c_str());
|
||||
|
||||
// Resize the window too
|
||||
if (Resize) MoveWindow(GetConsoleWindow(), Left,Top, (Width + 100),Height, true);
|
||||
if (Resize)
|
||||
MoveWindow(GetConsoleWindow(), Left, Top, (Width + 100), Height, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -328,7 +332,8 @@ void ConsoleListener::ClearScreen(bool Cursor)
|
||||
GetConsoleScreenBufferInfo(hConsole, &csbi);
|
||||
FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);
|
||||
// Reset cursor
|
||||
if (Cursor) SetConsoleCursorPosition(hConsole, coordScreen);
|
||||
if (Cursor)
|
||||
SetConsoleCursorPosition(hConsole, coordScreen);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
|
||||
char temp[MAX_MSGLEN];
|
||||
LogContainer *log = m_Log[type];
|
||||
|
||||
if (!log->IsEnabled() || level > log->GetLevel() || ! log->HasListeners())
|
||||
if (!log->IsEnabled() || level > log->GetLevel() || !log->HasListeners())
|
||||
return;
|
||||
|
||||
CharArrayFromFormatV(temp, MAX_MSGLEN, format, args);
|
||||
|
||||
@@ -109,10 +109,10 @@ void* AllocateMemoryPages(size_t size)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void* AllocateAlignedMemory(size_t size,size_t alignment)
|
||||
void* AllocateAlignedMemory(size_t size, size_t alignment)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
void* ptr = _aligned_malloc(size,alignment);
|
||||
void* ptr = _aligned_malloc(size, alignment);
|
||||
#else
|
||||
void* ptr = nullptr;
|
||||
if (posix_memalign(&ptr, alignment, size) != 0)
|
||||
|
||||
@@ -74,7 +74,7 @@ bool MsgAlert(bool yes_no, int Style, const char* format, ...)
|
||||
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
CharArrayFromFormatV(buffer, sizeof(buffer)-1, str_translator(format).c_str(), args);
|
||||
CharArrayFromFormatV(buffer, sizeof(buffer) - 1, str_translator(format).c_str(), args);
|
||||
va_end(args);
|
||||
|
||||
ERROR_LOG(MASTER_LOG, "%s: %s", caption.c_str(), buffer);
|
||||
|
||||
@@ -45,14 +45,14 @@ size_t XEmitter::ABI_PushRegistersAndAdjustStack(BitSet32 mask, size_t rsp_align
|
||||
ABI_CalculateFrameSize(mask, rsp_alignment, needed_frame_size, &shadow, &subtraction, &xmm_offset);
|
||||
|
||||
for (int r : mask & ABI_ALL_GPRS)
|
||||
PUSH((X64Reg) r);
|
||||
PUSH((X64Reg)r);
|
||||
|
||||
if (subtraction)
|
||||
SUB(64, R(RSP), subtraction >= 0x80 ? Imm32((u32)subtraction) : Imm8((u8)subtraction));
|
||||
|
||||
for (int x : mask & ABI_ALL_FPRS)
|
||||
{
|
||||
MOVAPD(MDisp(RSP, (int)xmm_offset), (X64Reg) (x - 16));
|
||||
MOVAPD(MDisp(RSP, (int)xmm_offset), (X64Reg)(x - 16));
|
||||
xmm_offset += 16;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ void XEmitter::ABI_PopRegistersAndAdjustStack(BitSet32 mask, size_t rsp_alignmen
|
||||
for (int r = 15; r >= 0; r--)
|
||||
{
|
||||
if (mask[r])
|
||||
POP((X64Reg) r);
|
||||
POP((X64Reg)r);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ struct ModRM
|
||||
ModRM(u8 modRM, u8 rex)
|
||||
{
|
||||
mod = modRM >> 6;
|
||||
reg = ((modRM >> 3) & 7) | ((rex & 4)?8:0);
|
||||
reg = ((modRM >> 3) & 7) | ((rex & 4) ? 8 : 0);
|
||||
rm = modRM & 7;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@ static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
|
||||
#if defined _LP64
|
||||
// Note: EBX is reserved on Mac OS X and in PIC on Linux, so it has to
|
||||
// restored at the end of the asm block.
|
||||
__asm__ (
|
||||
__asm__(
|
||||
"cpuid;"
|
||||
"movl %%ebx,%1;"
|
||||
: "=a" (*eax),
|
||||
@@ -32,7 +32,7 @@ static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
|
||||
: "rbx"
|
||||
);
|
||||
#else
|
||||
__asm__ (
|
||||
__asm__(
|
||||
"cpuid;"
|
||||
"movl %%ebx,%1;"
|
||||
: "=a" (*eax),
|
||||
@@ -219,7 +219,8 @@ void CPUInfo::Detect()
|
||||
logical_cpu_count /= cores_x_package;
|
||||
}
|
||||
}
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use AMD's new method.
|
||||
num_cores = (cpu_id[2] & 0xFF) + 1;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user