IDA SDK
Public Member Functions | List of all members
bitrange_t Class Reference

Detailed Description

This class manages the offset and size of a value that occupies a number of contiguous bits within some container - generally a byte array.

A special state - empty range (both offset and size are zeroes) - determines the value as all bits of the container.

Public Member Functions

 bitrange_t (uint16 bit_ofs=0, uint16 size_in_bits=0)
 Constructor.
 
void init (uint16 bit_ofs, uint16 size_in_bits)
 Initialize offset and size to given values.
 
void reset ()
 Make the bitrange empty.
 
bool empty () const
 Is the bitrange empty?
 
uint bitoff () const
 Get offset of 1st bit.
 
uint bitsize () const
 Get size of the value in bits.
 
uint bytesize () const
 Size of the value in bytes.
 
uint64 mask64 () const
 Convert to mask of 64 bits.
 
bool combine (const bitrange_t &subrange)
 Make the superposition of the current bitrange and given bitrange.
 
void intersect (const bitrange_t &r)
 Intersect two ranges.
 
void create_union (const bitrange_t &r)
 Create union of 2 ranges including the hole between them.
 
void shift_down (uint cnt)
 Shift range down (left)
 
void shift_up (uint cnt)
 Shift range up (right)
 
template<class T >
void assign_max_nonzero (T mask)
 Initialize bitrange_t with offset/size defined by given mask.
 
Extract

Extract a value from 'src' according to the bitrange

Parameters
dstvector the extracted value will be stored to
srcsource buffer
src_sizesize of source buffer
is_mfis Msb First? (TRUE-big endian, FALSE-little endian)
bool extract (bytevec_t *dst, const void *src, size_t src_size, bool is_mf) const
 
bool extract (void *dst, size_t dst_size, const void *src, size_t src_size, bool is_mf) const
 
Inject

Inject a value into 'dst' according to the bitrange

Parameters
dsta buffer the value will be injected into
dst_sizesize of buffer
srcsource value
is_mfis Msb First? (TRUE-big endian, FALSE-little endian)
bool inject (void *dst, size_t dst_size, const void *src, size_t src_size, bool is_mf) const
 
bool inject (void *dst, size_t dst_size, const bytevec_t &src, bool is_mf) const
 

The documentation for this class was generated from the following file: