[misc] miscellaneous code cleanup and fixes

* Don't use hDrive handle for longer than necessary
* Move all the popcount() function calls into missing.h
* Ensure that the thread_affinity[] array is properly sized
* Improve timeouts for conflicting process search
This commit is contained in:
Pete Batard 2020-09-09 17:00:39 +01:00
parent 7df88aa931
commit b3caf638b6
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
6 changed files with 25 additions and 33 deletions

View file

@ -37,16 +37,6 @@ int nWindowsVersion = WINDOWS_UNDEFINED;
int nWindowsBuildNumber = -1;
char WindowsVersionStr[128] = "Windows ";
// __popcnt16, __popcnt, __popcnt64 are not available for ARM :(
uint8_t popcnt8(uint8_t val)
{
static const uint8_t nibble_lookup[16] = {
0, 1, 1, 2, 1, 2, 2, 3,
1, 2, 2, 3, 2, 3, 3, 4
};
return nibble_lookup[val & 0x0F] + nibble_lookup[val >> 4];
}
/*
* Hash table functions - modified From glibc 2.3.2:
* [Aho,Sethi,Ullman] Compilers: Principles, Techniques and Tools, 1986