# if !defined (PS_BITSET_H)
# define PS_BITSET_H

/** \file psBitset.h
 *  \brief Bitset manipulations and operations.
 *  \ingroup MathGroup
 */

/** A bitset of arbitrary length. */
typedef struct {
    int n;				///< Number of chars that form the bitset
    char *bits;				///< The bits
} psBitset;

/** Functions **************************************************************/
/** \addtogroup MathGroup Math Utilities
 *  \{
 */

/** Constructor */
psBitset *psBitsetAlloc(int n)		///< Number of bits required
;

/************************************************************************************************************/

/** Set a bitset */
psBitset *
psBitsetSet(psBitset *myBits,		///< Input bitset
	    int bit)			///< Bit to set
;

/** Check a bitset.  Returns true or false */
bool
psBitsetTest(const psBitset *checkBits, ///< bitset to check
	     int bit)			///< Bit to check
;

/** apply the given operator to two bitsets */
psBitset *
psBitsetOp(psBitset *outBits,		///< Output bitset or NULL
	   const psBitset *inBits1,	///< Input bitset 1
	   char *operator,		///< bitset operator (AND, OR, XOR)
	   const psBitset *inBits2)	///< Input bitset 2
;

/** Apply unary NOT to a bitset */
psBitset *
psBitsetNot(psBitset *out,		///< Output bitset, or NULL
	    psBitset *in)		///< Input bitset to be NOT-ed
;

/* \} */ // End of MathGroup Functions

#endif 
