ida_bitrange

Definition of the bitrange_t class.

Classes

bitrange_t

Module Contents

class ida_bitrange.bitrange_t(bit_ofs: uint16 = 0, size_in_bits: uint16 = 0)

Bases: object

thisown
init(bit_ofs: uint16, size_in_bits: uint16) → None

Initialize offset and size to given values.

reset() → None

Make the bitrange empty.

empty() → bool

Is the bitrange empty?

bitoff() → uint

Get offset of 1st bit.

bitsize() → uint

Get size of the value in bits.

bytesize() → uint

Size of the value in bytes.

mask64() → uint64

Convert to mask of 64 bits.

has_common(r: bitrange_t) → bool

Does have common bits with another bitrange?

apply_mask(subrange: bitrange_t) → bool

Apply mask to a bitrange

Parameters:

subrange – range inside the main bitrange to keep After this operation the main bitrange will be truncated to have only the bits that are specified by subrange. Example: [off=8,nbits=4], subrange[off=1,nbits=2] => [off=9,nbits=2]

Returns:

success

intersect(r: bitrange_t) → None

Intersect two ranges.

create_union(r: bitrange_t) → None

Create union of 2 ranges including the hole between them.

sub(r: bitrange_t) → bool

Subtract a bitrange.

shift_down(cnt: uint) → None

Shift range down (left).

shift_up(cnt: uint) → None

Shift range up (right).

extract(src: void const *, is_mf: bool) → bool
inject(dst: void *, src: bytevec_t const &, is_mf: bool) → bool
compare(r: bitrange_t) → int