26 inline bool empty()
const;
114 : offset(bit_ofs), nbits(size_in_bits)
122 nbits = size_in_bits;
152 return (nbits + 8-1) / 8;
173 uint16 e1 = offset + nbits;
174 uint16 e2 = r.offset + r.nbits;
176 uint16 s = qmax(offset, r.offset);
194 uint16 e1 = offset + nbits;
195 uint16 e2 = r.offset + r.nbits;
197 uint16 s = qmin(offset, r.offset);
207 uint16 rend = r.offset + r.nbits;
208 if ( r.offset > offset && rend <
end )
210 if ( r.offset <= offset )
216 else if ( rend > offset )
219 nbits =
end - offset;
222 else if ( r.offset <
end )
224 nbits = r.offset - offset;
230inline int bitrange_t::compare(
const bitrange_t &r)
const
232 if ( offset != r.offset )
233 return offset < r.offset ? -1 : 1;
234 if (
nbits != r.nbits )
235 return nbits < r.nbits ? -1 : 1;
273 for ( i=0; i <
sizeof(T)*8; ++i, bit <<= 1 )
274 if ( (mask & bit) != 0 )
279 while ( i >= offset )
281 if ( (mask & bit) != 0 )
286 nbits = i - offset + 1;
321 dst->
begin(), dst_size,
idaman bool ida_export bitrange_t_extract_using_bitrange(const bitrange_t *bm, void *dst, size_t dst_size, const void *src, size_t src_size, bool is_mf)
idaman bool ida_export bitrange_t_inject_using_bitrange(const bitrange_t *bm, void *dst, size_t dst_size, const void *src, size_t src_size, bool is_mf)
idaman int ida_export nbits(ea_t ea)
Get number of bits in a byte at the given address.
This class manages the offset and size of a value that occupies a number of contiguous bits within so...
Definition bitrange.hpp:16
uint bytesize() const
Size of the value in bytes.
Definition bitrange.hpp:150
bool empty() const
Is the bitrange empty?
Definition bitrange.hpp:132
bool sub(const bitrange_t &r)
Subtract a bitrange.
Definition bitrange.hpp:202
bool has_common(const bitrange_t &r) const
Does have common bits with another bitrange?
Definition bitrange.hpp:186
void shift_down(uint cnt)
Shift range down (left)
Definition bitrange.hpp:240
uint64 mask64() const
Convert to mask of 64 bits.
Definition bitrange.hpp:156
bool inject(void *dst, size_t dst_size, const void *src, size_t src_size, bool is_mf) const
Definition bitrange.hpp:327
void shift_up(uint cnt)
Shift range up (right)
Definition bitrange.hpp:258
bool extract(bytevec_t *dst, const void *src, size_t src_size, bool is_mf) const
Definition bitrange.hpp:312
bool apply_mask(const bitrange_t &subrange)
Apply mask to a bitrange.
Definition bitrange.hpp:162
uint bitoff() const
Get offset of 1st bit.
Definition bitrange.hpp:138
bitrange_t(uint16 bit_ofs=0, uint16 size_in_bits=0)
Constructor.
Definition bitrange.hpp:113
DECLARE_COMPARISONS(bitrange_t)
void reset()
Make the bitrange empty.
Definition bitrange.hpp:126
void assign_max_nonzero(T mask)
Initialize bitrange_t with offset/size defined by given mask.
Definition bitrange.hpp:264
void init(uint16 bit_ofs, uint16 size_in_bits)
Initialize offset and size to given values.
Definition bitrange.hpp:119
uint bitsize() const
Get size of the value in bits.
Definition bitrange.hpp:144
void create_union(const bitrange_t &r)
Create union of 2 ranges including the hole between them.
Definition bitrange.hpp:192
void intersect(const bitrange_t &r)
Intersect two ranges.
Definition bitrange.hpp:171
Vector of bytes (use for dynamic memory)
Definition pro.h:3773
void resize(size_t _newsize, const T &x)
Resize to the given size.
Definition pro.h:2469
iterator begin(void)
Get an iterator that points to the first element in the qvector.
Definition pro.h:2609
size_t size(void) const
Get the number of elements in the qvector.
Definition pro.h:2423
idaman const char * end
Definition pro.h:1001
cexpr_t * e
Definition hexrays.hpp:7308
unsigned __int64 uint64
Definition llong.hpp:13
THREAD_SAFE constexpr bool overlap(uval_t off1, asize_t s1, uval_t off2, asize_t s2)
Do (off1,s1) and (off2,s2) overlap?
Definition pro.h:1459
unsigned short uint16
unsigned 16 bit value
Definition pro.h:346
unsigned int uint
unsigned 32 bit value
Definition pro.h:339
constexpr T left_shift(const T &value, int shift)
Shift by the amount exceeding the operand size*8 is undefined by the standard.
Definition pro.h:1481