mirror of
https://github.com/holub/mame
synced 2025-07-05 09:57:47 +03:00
C+14 dammit (nw)
This commit is contained in:
parent
447447befc
commit
37619d7ca2
@ -305,7 +305,7 @@ inline unsigned population_count_32(uint32_t val)
|
|||||||
{
|
{
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
// uses CPU feature if available, otherwise falls back to implementation similar to what follows
|
// uses CPU feature if available, otherwise falls back to implementation similar to what follows
|
||||||
static_assert(sizeof(val) == sizeof(unsigned));
|
static_assert(sizeof(val) == sizeof(unsigned), "expected 32-bit unsigned int");
|
||||||
return unsigned(__builtin_popcount(static_cast<unsigned>(val)));
|
return unsigned(__builtin_popcount(static_cast<unsigned>(val)));
|
||||||
#else
|
#else
|
||||||
// optimal Hamming weight assuing fast 32*32->32
|
// optimal Hamming weight assuing fast 32*32->32
|
||||||
@ -332,7 +332,7 @@ inline unsigned population_count_64(uint64_t val)
|
|||||||
{
|
{
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
// uses CPU feature if available, otherwise falls back to implementation similar to what follows
|
// uses CPU feature if available, otherwise falls back to implementation similar to what follows
|
||||||
static_assert(sizeof(val) == sizeof(unsigned long long));
|
static_assert(sizeof(val) == sizeof(unsigned long long), "expected 64-bit unsigned long long int");
|
||||||
return unsigned(__builtin_popcountll(static_cast<unsigned long long>(val)));
|
return unsigned(__builtin_popcountll(static_cast<unsigned long long>(val)));
|
||||||
#else
|
#else
|
||||||
// guess that architectures with 64-bit pointers have 64-bit multiplier
|
// guess that architectures with 64-bit pointers have 64-bit multiplier
|
||||||
|
Loading…
Reference in New Issue
Block a user