#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