decompiler 1.0.0
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
ghidra::TypeBitField Class Reference

A field within a structure that is not aligned or sized on byte boundaries. More...

#include <type.hh>

Public Member Functions

 TypeBitField (Decoder &decoder, TypeFactory &typegrp)
 Restore this bitfield from a stream.
 
 TypeBitField (int4 id, int4 numBits, bool isBigEndian, const string &nm, Datatype *ct)
 Construct from components.
 
int4 compare (const TypeBitField &op2) const
 Compare definition of this with another TypeBitField for propagation ordering.
 
int4 compareDependency (const TypeBitField &op2) const
 Compare this with another TypeBitField for functional equivalence.
 
void encode (Encoder &encoder) const
 Encode this bitfield to a stream.
 

Static Public Member Functions

static bool compareMaxByte (int4 off, const TypeBitField &bitfield)
 

Public Attributes

string name
 Name of bitfield.
 
Datatypetype
 Underlying (integer) data-type.
 
BitRange bits
 Description of the bitfield within its structure.
 
int4 ident
 Identifier of this within containing structure.
 

Detailed Description

A field within a structure that is not aligned or sized on byte boundaries.

Constructor & Destructor Documentation

◆ TypeBitField()

ghidra::TypeBitField::TypeBitField ( int4  id,
int4  numBits,
bool  isBigEndian,
const string &  nm,
Datatype ct 
)

Construct from components.

Create the bitfield only knowing the number of bits and the position of the field within the declaration. The bit offset and byte offset must be calculated later via TypeStruct::assignFieldOffsets

Parameters
idis the position of the bitfield within the declaration, where contiguous bitfields share the same position
numBitsis the number of bits in the bitfield
isBigEndianis true if the bitfield is stored in a big endian container
nmis the name of the bitfield
ctis the integer data-type associated with the bitfield

References ident, and type.

Member Function Documentation

◆ compare()

int4 ghidra::TypeBitField::compare ( const TypeBitField op2) const

Compare definition of this with another TypeBitField for propagation ordering.

Compare meta-data of the two bit-fields for use with TypeStruct::compare

Parameters
op2is the other TypeBitField to compare with this
Returns
-1, 0, or 1 for less than, equal, or greater than ordering

References bits, ghidra::BitRange::compare(), ghidra::Datatype::getMetatype(), name, and type.

◆ compareDependency()

int4 ghidra::TypeBitField::compareDependency ( const TypeBitField op2) const

Compare this with another TypeBitField for functional equivalence.

Compare structure of the two bit-fields for use with TypeStruct::compareDependency.

Parameters
op2is the other TypeBitField to compare with this
Returns
-1, 0, or 1 for less than, equal, or greater than ordering

References bits, ghidra::BitRange::compare(), name, and type.

◆ compareMaxByte()

static bool ghidra::TypeBitField::compareMaxByte ( int4  off,
const TypeBitField bitfield 
)
inlinestatic

< Compare byte container end-point to the given offset

References bits, ghidra::BitRange::byteOffset, and ghidra::BitRange::byteSize.

Referenced by ghidra::TypeStruct::collectBitFields(), and ghidra::TypeStruct::hasBitFieldsInRange().


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