P4C
The P4 Compiler
Loading...
Searching...
No Matches
P4::bitvec Class Reference
Inheritance diagram for P4::bitvec:
[legend]

Classes

class  const_bitref
 
class  copy_bitref
 
class  nonconst_bitref
 

Public Types

typedef const_bitref const_iterator
 
typedef nonconst_bitref iterator
 

Public Member Functions

 bitvec (bitvec &&a)
 
 bitvec (const bitvec &a)
 
 bitvec (size_t lo, size_t cnt)
 
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value && (sizeof(T) > sizeof(uintptr_t))>::type>
 bitvec (T v)
 
 bitvec (uintptr_t v)
 
nonconst_bitref begin () &
 
copy_bitref begin () &&
 
const_bitref begin () const &
 
void clear ()
 
bool clrbit (size_t idx)
 
void clrrange (size_t idx, size_t sz)
 
bool contains (const bitvec &a) const
 
bool empty () const
 
nonconst_bitref end () &
 
copy_bitref end () &&
 
const_bitref end () const &
 
int ffs (unsigned start=0) const
 
unsigned ffz (unsigned start=0) const
 
bool getbit (size_t idx) const
 
uintmax_t getrange (size_t idx, size_t sz) const
 
bitvec getslice (size_t idx, size_t sz) const
 
bool intersects (const bitvec &a) const
 
bool is_contiguous () const
 
nonconst_bitref max () &
 
copy_bitref max () &&
 
const_bitref max () const &
 
nonconst_bitref min () &
 
copy_bitref min () &&
 
const_bitref min () const &
 
 operator bool () const
 
bool operator!= (const bitvec &a) const
 
bitvec operator& (const bitvec &a) const
 
bool operator&= (const bitvec &a)
 
bitvec operator- (const bitvec &a) const
 
bool operator-= (const bitvec &a)
 
bool operator< (const bitvec &a) const
 
bitvec operator<< (size_t count) const
 
bitvecoperator<<= (size_t count)
 
bool operator<= (const bitvec &a) const
 
bitvecoperator= (bitvec &&a)
 
bitvecoperator= (const bitvec &a)
 
bool operator== (const bitvec &a) const
 
bool operator> (const bitvec &a) const
 
bool operator>= (const bitvec &a) const
 
bitvec operator>> (size_t count) const
 
bitvecoperator>>= (size_t count)
 
nonconst_bitref operator[] (int idx)
 
bool operator[] (int idx) const
 
bitvec operator^ (const bitvec &a) const
 
bitvecoperator^= (const bitvec &a)
 
bitvec operator| (const bitvec &a) const
 
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value && (sizeof(T) > sizeof(uintptr_t))>::type>
bitvec operator| (T a)
 
bitvec operator| (uintptr_t a) const
 
bool operator|= (const bitvec &a)
 
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value && (sizeof(T) > sizeof(uintptr_t))>::type>
bool operator|= (T a)
 
bool operator|= (uintptr_t a)
 
int popcount () const
 
void putrange (size_t idx, size_t sz, uintmax_t v)
 
void rotate_right (size_t start_bit, size_t rotation_idx, size_t end_bit)
 
bitvec rotate_right_copy (size_t start_bit, size_t rotation_idx, size_t end_bit) const
 
bool setbit (size_t idx)
 
void setrange (size_t idx, size_t sz)
 
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value && (sizeof(T) > sizeof(uintptr_t))>::type>
void setraw (T *raw, size_t sz)
 
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value && (sizeof(T) > sizeof(uintptr_t))>::type>
void setraw (T raw)
 
void setraw (uintptr_t *raw, size_t sz)
 
void setraw (uintptr_t raw)
 

Static Public Attributes

static constexpr size_t bits_per_unit = CHAR_BIT * sizeof(uintptr_t)
 

Friends

std::ostream & operator<< (std::ostream &os, const bitvec &bv)
 
bool operator>> (const char *s, bitvec &bv)
 
std::istream & operator>> (std::istream &is, bitvec &bv)
 

Member Function Documentation

◆ rotate_right()

void P4::bitvec::rotate_right ( size_t start_bit,
size_t rotation_idx,
size_t end_bit )

Designed to imitate the std::rotate/stdrotate_copy function for vectors. Return a bitvec which has the bit at rotation_idx appear at start_bit, and the corresponding data between start_bit and end_bit rotated. Similar to std::rotate/stdrotate_copy, end_bit is exclusive