Compare commits
2 Commits
master
...
submit/Cou
Author | SHA1 | Date | |
---|---|---|---|
|
bd2171ec9d | ||
|
f8eae88dc7 |
|
@ -51,7 +51,8 @@ SOFTWARE.
|
|||
#ifndef _XSERVER_INPUT_PRIV_H
|
||||
#define _XSERVER_INPUT_PRIV_H
|
||||
|
||||
#include "input.h"
|
||||
#include "include/input.h"
|
||||
#include "include/inputstr.h"
|
||||
|
||||
typedef struct _InputOption InputOption;
|
||||
typedef struct _XI2Mask XI2Mask;
|
||||
|
@ -364,4 +365,20 @@ int InputThreadRegisterDev(int fd,
|
|||
|
||||
int InputThreadUnregisterDev(int fd);
|
||||
|
||||
/*
|
||||
* @brief count the bits set in the given bitmask
|
||||
*
|
||||
* @param mask pointer to bitmask
|
||||
* @param len size of bitmask in bits (may span multiple bytes)
|
||||
* @return number of bits set in the given bitmask
|
||||
*/
|
||||
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
|
||||
|
|
|
@ -63,7 +63,6 @@ extern _X_EXPORT void AssignTypeAndName(DeviceIntPtr dev,
|
|||
#define BitIsOn(ptr, bit) (!!(((const BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7))))
|
||||
#define SetBit(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] |= (1 << ((bit) & 7)))
|
||||
#define ClearBit(ptr, bit) (((BYTE *)(ptr))[(bit)>>3] &= ~(1 << ((bit) & 7)))
|
||||
extern _X_EXPORT int CountBits(const uint8_t * mask, int len);
|
||||
|
||||
#define SameClient(obj,client) \
|
||||
(CLIENT_BITS((obj)->resource) == (client)->clientAsMask)
|
||||
|
|
Loading…
Reference in New Issue