#pragma once

/* a=target variable, b=bit number to act upon 0-n */
#define BIT_SET(a, b)   ((a) |= (1i64 << (b)))
#define BIT_CLEAR(a, b) ((a) &= ~(1i64 << (b)))
#define BIT_FLIP(a, b)  ((a) ^= (1i64 << (b)))
#define BIT_CHECK(a, b) (((a) & (1i64 << (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)
