]>
git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_codesigning/antlr2/src/BitSet.cpp
1 /* ANTLR Translator Generator
2 * Project led by Terence Parr at http://www.jGuru.com
3 * Software rights: http://www.antlr.org/license.html
5 * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/BitSet.cpp#2 $
7 #include "antlr/BitSet.hpp"
10 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
14 BitSet::BitSet(unsigned int nbits
)
17 for (unsigned int i
= 0; i
< nbits
; i
++ )
21 BitSet::BitSet( const unsigned long* bits_
, unsigned int nlongs
)
24 for ( unsigned int i
= 0 ; i
< (nlongs
* 32); i
++)
25 storage
[i
] = (bits_
[i
>>5] & (1UL << (i
&31))) ? true : false;
32 void BitSet::add(unsigned int el
)
34 if( el
>= storage
.size() )
35 storage
.resize( el
+1, false );
40 bool BitSet::member(unsigned int el
) const
42 if ( el
>= storage
.size())
48 ANTLR_USE_NAMESPACE(std
)vector
<unsigned int> BitSet::toArray() const
50 ANTLR_USE_NAMESPACE(std
)vector
<unsigned int> elems
;
51 for (unsigned int i
= 0; i
< storage
.size(); i
++)
60 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE