SetupSystem.cpp (muscle7.61) | : | SetupSystem.cpp (muscle7.62) | ||
---|---|---|---|---|
skipping to change at line 997 | skipping to change at line 997 | |||
if (m) m->Unlock(); | if (m) m->Unlock(); | |||
} | } | |||
static CompleteSetupSystem * _activeCSS = NULL; | static CompleteSetupSystem * _activeCSS = NULL; | |||
CompleteSetupSystem * CompleteSetupSystem :: GetCurrentCompleteSetupSystem() {re turn _activeCSS;} | CompleteSetupSystem * CompleteSetupSystem :: GetCurrentCompleteSetupSystem() {re turn _activeCSS;} | |||
CompleteSetupSystem :: CompleteSetupSystem(bool muscleSingleThreadOnly) | CompleteSetupSystem :: CompleteSetupSystem(bool muscleSingleThreadOnly) | |||
: _threads(muscleSingleThreadOnly) | : _threads(muscleSingleThreadOnly) | |||
, _prevInstance(_activeCSS) | , _prevInstance(_activeCSS) | |||
, _initialMemoryUsage(GetProcessMemoryUsage()) | , _initialMemoryUsage((size_t) GetProcessMemoryUsage()) | |||
{ | { | |||
_activeCSS = this; // push us onto the stack | _activeCSS = this; // push us onto the stack | |||
} | } | |||
CompleteSetupSystem :: ~CompleteSetupSystem() | CompleteSetupSystem :: ~CompleteSetupSystem() | |||
{ | { | |||
// We'll assume that by this point all spawned threads are gone, and therefor e mutex-ordering problems detected after this are not real problems. | // We'll assume that by this point all spawned threads are gone, and therefor e mutex-ordering problems detected after this are not real problems. | |||
#ifdef MUSCLE_ENABLE_DEADLOCK_FINDER | #ifdef MUSCLE_ENABLE_DEADLOCK_FINDER | |||
_enableDeadlockFinderPrints = false; | _enableDeadlockFinderPrints = false; | |||
#endif | #endif | |||
skipping to change at line 1729 | skipping to change at line 1729 | |||
const unsigned char * data = (const unsigned char *)key; | const unsigned char * data = (const unsigned char *)key; | |||
uint32 h = seed ^ numBytes; | uint32 h = seed ^ numBytes; | |||
const uint32 align = ((uint32)((uintptr)data)) & 3; | const uint32 align = ((uint32)((uintptr)data)) & 3; | |||
if ((align!=0)&&(numBytes >= 4)) | if ((align!=0)&&(numBytes >= 4)) | |||
{ | { | |||
// Pre-load the temp registers | // Pre-load the temp registers | |||
uint32 t = 0, d = 0; | uint32 t = 0, d = 0; | |||
switch(align) | switch(align) | |||
{ | { | |||
case 1: t |= data[2] << 16; | case 1: t |= data[2] << 16; // fall through! | |||
case 2: t |= data[1] << 8; | case 2: t |= data[1] << 8; // fall through! | |||
case 3: t |= data[0]; | case 3: t |= data[0]; // fall through! | |||
} | } | |||
t <<= (8 * align); | t <<= (8 * align); | |||
data += 4-align; | data += 4-align; | |||
numBytes -= 4-align; | numBytes -= 4-align; | |||
int32 sl = 8 * (4-align); | int32 sl = 8 * (4-align); | |||
int32 sr = 8 * align; | int32 sr = 8 * align; | |||
// Mix | // Mix | |||
skipping to change at line 1761 | skipping to change at line 1761 | |||
data += 4; | data += 4; | |||
numBytes -= 4; | numBytes -= 4; | |||
} | } | |||
// Handle leftover data in temp registers | // Handle leftover data in temp registers | |||
d = 0; | d = 0; | |||
if(numBytes >= align) | if(numBytes >= align) | |||
{ | { | |||
switch(align) | switch(align) | |||
{ | { | |||
case 3: d |= data[2] << 16; | case 3: d |= data[2] << 16; // fall through | |||
case 2: d |= data[1] << 8; | case 2: d |= data[1] << 8; // fall through | |||
case 1: d |= data[0]; | case 1: d |= data[0]; // fall through | |||
} | } | |||
uint32 k = (t >> sr) | (d << sl); | uint32 k = (t >> sr) | (d << sl); | |||
MURMUR2_MIX(h,k,m); | MURMUR2_MIX(h,k,m); | |||
data += align; | data += align; | |||
numBytes -= align; | numBytes -= align; | |||
//---------- | //---------- | |||
// Handle tail bytes | // Handle tail bytes | |||
switch(numBytes) | switch(numBytes) | |||
{ | { | |||
case 3: h ^= data[2] << 16; | case 3: h ^= data[2] << 16; // fall through! | |||
case 2: h ^= data[1] << 8; | case 2: h ^= data[1] << 8; // fall through! | |||
case 1: h ^= data[0]; | case 1: h ^= data[0]; // fall through! | |||
h *= m; | h *= m; | |||
}; | }; | |||
} | } | |||
else | else | |||
{ | { | |||
switch(numBytes) | switch(numBytes) | |||
{ | { | |||
case 3: d |= data[2] << 16; | case 3: d |= data[2] << 16; // fall through! | |||
case 2: d |= data[1] << 8; | case 2: d |= data[1] << 8; // fall through! | |||
case 1: d |= data[0]; | case 1: d |= data[0]; // fall through! | |||
case 0: h ^= (t >> sr) | (d << sl); | case 0: h ^= (t >> sr) | (d << sl); | |||
h *= m; | h *= m; | |||
} | } | |||
} | } | |||
h ^= h >> 13; | h ^= h >> 13; | |||
h *= m; | h *= m; | |||
h ^= h >> 15; | h ^= h >> 15; | |||
return h; | return h; | |||
skipping to change at line 1815 | skipping to change at line 1815 | |||
MURMUR2_MIX(h,k,m); | MURMUR2_MIX(h,k,m); | |||
data += 4; | data += 4; | |||
numBytes -= 4; | numBytes -= 4; | |||
} | } | |||
//---------- | //---------- | |||
// Handle tail bytes | // Handle tail bytes | |||
switch(numBytes) | switch(numBytes) | |||
{ | { | |||
case 3: h ^= data[2] << 16; | case 3: h ^= data[2] << 16; // fall through! | |||
case 2: h ^= data[1] << 8; | case 2: h ^= data[1] << 8; // fall through! | |||
case 1: h ^= data[0]; | case 1: h ^= data[0]; // fall through! | |||
h *= m; | h *= m; | |||
}; | }; | |||
h ^= h >> 13; | h ^= h >> 13; | |||
h *= m; | h *= m; | |||
h ^= h >> 15; | h ^= h >> 15; | |||
return h; | return h; | |||
} | } | |||
} | } | |||
skipping to change at line 1852 | skipping to change at line 1852 | |||
k *= m; | k *= m; | |||
k ^= k >> r; | k ^= k >> r; | |||
k *= m; | k *= m; | |||
h ^= k; | h ^= k; | |||
h *= m; | h *= m; | |||
} | } | |||
const unsigned char * data2 = (const unsigned char*)data; | const unsigned char * data2 = (const unsigned char*)data; | |||
switch(numBytes & 7) | switch(numBytes & 7) | |||
{ | { | |||
case 7: h ^= uint64(data2[6]) << 48; | case 7: h ^= uint64(data2[6]) << 48; // fall through! | |||
case 6: h ^= uint64(data2[5]) << 40; | case 6: h ^= uint64(data2[5]) << 40; // fall through! | |||
case 5: h ^= uint64(data2[4]) << 32; | case 5: h ^= uint64(data2[4]) << 32; // fall through! | |||
case 4: h ^= uint64(data2[3]) << 24; | case 4: h ^= uint64(data2[3]) << 24; // fall through! | |||
case 3: h ^= uint64(data2[2]) << 16; | case 3: h ^= uint64(data2[2]) << 16; // fall through! | |||
case 2: h ^= uint64(data2[1]) << 8; | case 2: h ^= uint64(data2[1]) << 8; // fall through! | |||
case 1: h ^= uint64(data2[0]); | case 1: h ^= uint64(data2[0]); // fall through! | |||
h *= m; | h *= m; | |||
} | } | |||
h ^= h >> r; | h ^= h >> r; | |||
h *= m; | h *= m; | |||
h ^= h >> r; | h ^= h >> r; | |||
return h; | return h; | |||
} | } | |||
#ifdef MUSCLE_ENABLE_OBJECT_COUNTING | #ifdef MUSCLE_ENABLE_OBJECT_COUNTING | |||
End of changes. 7 change blocks. | ||||
23 lines changed or deleted | 23 lines changed or added |