dix: make CountBits() inline
The function is small enough for easily being inlined. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
e7e248f303
commit
a17e8bda4d
|
@ -53,6 +53,7 @@ SOFTWARE.
|
|||
|
||||
#include "include/cursor.h"
|
||||
#include "include/input.h"
|
||||
#include "include/inputstr.h"
|
||||
|
||||
void InitCoreDevices(void);
|
||||
void InitXTestDevices(void);
|
||||
|
@ -516,6 +517,13 @@ void LastEventTimeToggleResetAll(Bool state);
|
|||
* @param len size of bitmask in bits (may span multiple bytes)
|
||||
* @return number of bits set in the given bitmask
|
||||
*/
|
||||
int CountBits(const uint8_t * mask, int len);
|
||||
static inline int CountBits(const uint8_t * mask, int len)
|
||||
{
|
||||
int ret = 0;
|
||||
for (int i = 0; i < len; i++)
|
||||
if (BitIsOn(mask, i))
|
||||
ret++;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* _XSERVER_INPUT_PRIV_H */
|
||||
|
|
|
@ -690,19 +690,6 @@ valuator_mask_fetch_unaccelerated(const ValuatorMask *mask,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
int
|
||||
CountBits(const uint8_t * mask, int len)
|
||||
{
|
||||
int i;
|
||||
int ret = 0;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
if (BitIsOn(mask, i))
|
||||
ret++;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies sanity of the event. If the event is not an internal event,
|
||||
* memdumps the first 32 bytes of event to the log, a backtrace, then kill
|
||||
|
|
Loading…
Reference in New Issue