1 #ifndef _PFC_BIT_ARRAY_H_ 2 #define _PFC_BIT_ARRAY_H_ 8 virtual bool get(
t_size n)
const = 0;
14 if (count==0)
return start;
15 else if (count<0) {d = -1; todo = -count;}
16 else {d = 1; todo = count;}
17 while(todo>0 &&
get(ptr)!=val) {ptr+=d;todo--;}
27 for(ptr=find(val,start,count);found<count_max && ptr<max;ptr=find(val,ptr+1,max-ptr-1)) found++;
42 virtual void set(
t_size n,
bool val)=0;
57 return m_permutation[n] != n;
68 #define PFC_FOR_EACH_INDEX( bitArray, var, count ) \ 69 for( size_t var = (bitArray).find_first( true, 0, (count) ); var < (count); var = (bitArray).find_next( true, var, (count) ) ) pfc::bit_array_var bit_array_var
t_size find_next(bool val, t_size previous, t_size max) const
t_size find_first(bool val, t_size start, t_size max) const
virtual t_size find(bool val, t_size start, t_ssize count) const
Returns the first occurance of val between start and start+count (excluding start+count), or start+count if not found; count may be negative to search back rather than forward. Can be overridden by bit_array implementations for improved speed in specific cases.
Bit array interface class, constant version (you can only retrieve values). Range of valid indexes d...
const t_size *const m_permutation
t_size calc_count(bool val, t_size start, t_size count, t_size count_max=~0) const
bool operator[](t_size n) const
Bit array interface class, variable version (you can both set and retrieve values). As with the constant version, valid index range depends on the context.
pfc::sized_int_t< sizeof(size_t) >::t_signed t_ssize
bit_array_wrapper_permutation(const t_size *p_permutation, t_size p_size)