mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Adds bit operation functions.
This commit is contained in:
parent
5113baa175
commit
941c1f929a
1 changed files with 18 additions and 0 deletions
18
util.h
18
util.h
|
|
@ -94,6 +94,24 @@ void pathprint(char* str, size_t size, const char* format, ...);
|
|||
*/
|
||||
void pathslash(char* str, size_t size);
|
||||
|
||||
/****************************************************************************/
|
||||
/* bit */
|
||||
|
||||
static inline int bit_has(unsigned bit, unsigned mask)
|
||||
{
|
||||
return (bit & mask) == mask;
|
||||
}
|
||||
|
||||
static inline unsigned bit_set(unsigned bit, unsigned mask)
|
||||
{
|
||||
return bit | mask;
|
||||
}
|
||||
|
||||
static inline unsigned bit_clear(unsigned bit, unsigned mask)
|
||||
{
|
||||
return bit & ~mask;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
/* memory */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue