/* "misc_bit_array.h" created by: grayspace aka J. Leveille for: UbixOS Project date: May 12, 2002 purpose: functions for dealing with bit arrays $Id$ */ #ifndef _MISC_BIT_ARRAY_H #define _MISC_BIT_ARRAY_H typedef struct tagBIT_ARRAY_RANGE_PARAMS { DWORDg * p_curdw; DWORDg * p_firstdw; DWORDg * p_overdw; DWORDg premask; DWORDg postmask; } BIT_ARRAY_RANGE_PARAMS; // returns: // - 1 if the given range of bits is empty // - 0 otherwise int BIT_ARRAY_IsRangeEmpty( BIT_ARRAY_RANGE_PARAMS * p_rp ); // set the given range of bits to all 1s void BIT_ARRAY_SetRange( BIT_ARRAY_RANGE_PARAMS * p_rp ); // set the given range of bits to all 0s void BIT_ARRAY_ResetRange( BIT_ARRAY_RANGE_PARAMS * p_rp ); // builds a structure for use with the other functions #define BIT_ARRAY_MAKERANGEPARAMS( rp, p_basedw, firstbit, overbit )\ (rp).premask = ((32-(firstbit))&31);\ (rp).p_firstdw = (p_basedw) + ((firstbit)>>5);\ (rp).postmask = ((overbit)&31);\ (rp).p_overdw = (p_basedw) + ((overbit)>>5);\ (rp).premask = MAKEMASK_GS( (rp).premask, (32 - (rp).premask) );\ (rp).postmask = MAKEMASK_GS( (rp).postmask, 0 ) #endif // _MISC_BIT_ARRAY_H