Move bitCount from utils to GlxBackend

Only used in GlxBackend.

Differential Revision: https://phabricator.kde.org/D6784
This commit is contained in:
Martin Flöser 2017-07-19 06:54:22 +02:00
parent da036098cf
commit 349618c214
2 changed files with 16 additions and 17 deletions

View file

@ -509,6 +509,22 @@ int GlxBackend::visualDepth(xcb_visualid_t visual) const
return m_visualDepthHash.value(visual);
}
static inline int bitCount(uint32_t mask)
{
#if defined(__GNUC__)
return __builtin_popcount(mask);
#else
int count = 0;
while (mask) {
count += (mask & 1);
mask >>= 1;
}
return count;
#endif
}
FBConfigInfo *GlxBackend::infoForVisual(xcb_visualid_t visual)
{
auto it = m_fbconfigHash.constFind(visual);

17
utils.h
View file

@ -196,23 +196,6 @@ Qt::KeyboardModifiers KWIN_EXPORT x11ToQtKeyboardModifiers(int state);
void checkNonExistentClients();
static inline int bitCount(uint32_t mask)
{
#if defined(__GNUC__)
return __builtin_popcount(mask);
#else
int count = 0;
while (mask) {
count += (mask & 1);
mask >>= 1;
}
return count;
#endif
}
/**
* Separate the concept of an unet QPoint and 0,0
*/