home *** CD-ROM | disk | FTP | other *** search
- #include "BitSet.h"
-
- #include <string.h>
-
- BitSet::BitSet(unsigned int size){
- numBytes = (size>>3) + 1;
- bytes=new unsigned char[numBytes];
- }
-
- BitSet::~BitSet(){
- delete bytes;
- }
-
- void BitSet::clear(unsigned int n){
- bytes[n>>3] &= ~(0x01<<(n&0x07));
- }
-
- void BitSet::clearAll(){
- memset(bytes, 0x00, numBytes);
- }
-
- void BitSet::set(unsigned int n){
- bytes[n>>3] |= (0x01<<(n&0x07));
- }
-
- void BitSet::setAll(){
- memset(bytes, 0xFF, numBytes);
- }
-
- bool BitSet::isSet(unsigned int n){
- return ( bytes[n>>3] & (0x01<<(n&0x07)) ) != 0;
- }
-