#pragma once namespace pfc { template class bit_array_table_t : public bit_array { const T * data; t_size count; bool after; public: inline bit_array_table_t(const T * p_data,t_size p_count,bool p_after = false) : data(p_data), count(p_count), after(p_after) { } bool get(t_size n) const { if (n class bit_array_var_table_t : public bit_array_var { T * data; t_size count; bool after; public: inline bit_array_var_table_t(T * p_data,t_size p_count,bool p_after = false) : data(p_data), count(p_count), after(p_after) { } bool get(t_size n) const { if (n bit_array_table; typedef bit_array_var_table_t bit_array_var_table; class bit_array_range : public bit_array { t_size begin,end; bool state; public: bit_array_range(t_size first,t_size count,bool p_state = true) : begin(first), end(first+count), state(p_state) {} bool get(t_size n) const { bool rv = n>=begin && n m_data; t_size m_count; public: //helpers template inline static bool g_get(const t_array & p_array,t_size idx) { return !! (p_array[idx>>3] & (1<<(idx&7))); } template inline static void g_set(t_array & p_array,t_size idx,bool val) { unsigned char & dst = p_array[idx>>3]; unsigned char mask = 1<<(idx&7); dst = val ? dst|mask : dst&~mask; } inline static t_size g_estimate_size(t_size p_count) {return (p_count+7)>>3;} void resize(t_size p_count); bit_array_bittable(t_size p_count) : m_count(0) {resize(p_count);} bit_array_bittable(const pfc::bit_array & in, size_t inSize); bit_array_bittable() : m_count() {} void set(t_size n, bool val); bool get(t_size n) const; size_t size() const {return m_count;} }; //! Bit array that takes a permutation and signals indexes reordered by the permutation. \n //! Valid index range same as length of the permutation. class bit_array_order_changed : public bit_array { public: bit_array_order_changed(const t_size * p_order) : m_order(p_order) {} bool get(t_size n) const { return m_order[n] != n; } private: const t_size * m_order; }; } // #define for_each_bit_array(var,mask,val,start,count) for(var = mask.find(val,start,count);var