[misc] reorganize UI function calls into their own source

* Also fix ARM/ARM64 broken compilation due to missing __popcnt()
This commit is contained in:
Pete Batard 2018-07-06 05:46:36 +01:00
parent a34cb1194e
commit 05f8400451
12 changed files with 1486 additions and 1363 deletions

View file

@ -36,6 +36,16 @@ 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