You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
504 B
C
16 lines
504 B
C
#ifndef _UTILITY_BITOP_H_
|
|
#define _UTILITY_BITOP_H_
|
|
#pragma once
|
|
/* a=target variable, b=bit number to act upon 0-n */
|
|
#define BIT_SET(a,b) ((a) |= (1<<(b)))
|
|
#define BIT_CLEAR(a,b) ((a) &= ~(1<<(b)))
|
|
#define BIT_FLIP(a,b) ((a) ^= (1<<(b)))
|
|
#define BIT_CHECK(a,b) (((a) & (1<<(b)))!=0)
|
|
|
|
/* x=target variable, y=mask */
|
|
#define BITMASK_SET(x,y) ((x) |= (y))
|
|
#define BITMASK_CLEAR(x,y) ((x) &= (~(y)))
|
|
#define BITMASK_FLIP(x,y) ((x) ^= (y))
|
|
#define BITMASK_CHECK(x,y) (((x) & (y))!=0)
|
|
|
|
#endif |