Package ghidra.program.model.data
Class BitFieldPackingImpl
java.lang.Object
ghidra.program.model.data.BitFieldPackingImpl
- All Implemented Interfaces:
BitFieldPacking
-
Field Summary
Modifier and TypeFieldDescriptionstatic final boolean
static final boolean
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Output the details of this bitfield packing to a encoded document formatter.boolean
int
A non-zero value indicates the fixed alignment size for bit-fields which follow a zero-length bitfield if greater than a bitfields base type normal alignment.int
hashCode()
boolean
Control whether the alignment of bit-field types is respected when laying out structures.protected void
restoreXml
(XmlPullParser parser) Restore settings from a<bitfield_packing>
tag in an XML stream.void
setTypeAlignmentEnabled
(boolean typeAlignmentEnabled) Control whether the alignment of bit-field types is respected when laying out structures.void
setUseMSConvention
(boolean useMSConvention) Control if the alignment and packing of bit-fields follows MSVC conventions.void
setZeroLengthBoundary
(int zeroLengthBoundary) Indicate a fixed alignment size in bytes which should be used for zero-length bit-fields.boolean
Control if the alignment and packing of bit-fields follows MSVC conventions.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ghidra.program.model.data.BitFieldPacking
isEquivalent
-
Field Details
-
DEFAULT_USE_MS_CONVENTION
public static final boolean DEFAULT_USE_MS_CONVENTION- See Also:
-
DEFAULT_TYPE_ALIGNMENT_ENABLED
public static final boolean DEFAULT_TYPE_ALIGNMENT_ENABLED- See Also:
-
DEFAULT_ZERO_LENGTH_BOUNDARY
public static final int DEFAULT_ZERO_LENGTH_BOUNDARY- See Also:
-
-
Constructor Details
-
BitFieldPackingImpl
public BitFieldPackingImpl()
-
-
Method Details
-
useMSConvention
public boolean useMSConvention()Description copied from interface:BitFieldPacking
Control if the alignment and packing of bit-fields follows MSVC conventions. When this is enabled it takes precedence over all other bitfield packing controls.- Specified by:
useMSConvention
in interfaceBitFieldPacking
- Returns:
- true if MSVC packing conventions are used, else false (e.g., GNU conventions apply).
-
isTypeAlignmentEnabled
public boolean isTypeAlignmentEnabled()Description copied from interface:BitFieldPacking
Control whether the alignment of bit-field types is respected when laying out structures. Corresponds to PCC_BITFIELD_TYPE_MATTERS in GCC.- Specified by:
isTypeAlignmentEnabled
in interfaceBitFieldPacking
- Returns:
- true when the alignment of the bit-field type should be used to impact the alignment of the containing structure, and ensure that individual bit-fields will not straddle an alignment boundary.
-
getZeroLengthBoundary
public int getZeroLengthBoundary()Description copied from interface:BitFieldPacking
A non-zero value indicates the fixed alignment size for bit-fields which follow a zero-length bitfield if greater than a bitfields base type normal alignment. Corresponds to EMPTY_FIELD_BOUNDARY in GCC. This value is only used whenBitFieldPacking.isTypeAlignmentEnabled()
returns false.- Specified by:
getZeroLengthBoundary
in interfaceBitFieldPacking
- Returns:
- fixed alignment size as number of bytes for a bit-field which follows a zero-length bit-field
-
setUseMSConvention
public void setUseMSConvention(boolean useMSConvention) Control if the alignment and packing of bit-fields follows MSVC conventions. When this is enabled it takes precedence over all other bitfield packing controls.- Parameters:
useMSConvention
- true if MSVC packing conventions are used, else false (e.g., GNU conventions apply).
-
setTypeAlignmentEnabled
public void setTypeAlignmentEnabled(boolean typeAlignmentEnabled) Control whether the alignment of bit-field types is respected when laying out structures. Corresponds to PCC_BITFIELD_TYPE_MATTERS in gcc.- Parameters:
typeAlignmentEnabled
- true if the alignment of the bit-field type should be used to impact the alignment of the containing structure, and ensure that individual bit-fields will not straddle an alignment boundary.
-
setZeroLengthBoundary
public void setZeroLengthBoundary(int zeroLengthBoundary) Indicate a fixed alignment size in bytes which should be used for zero-length bit-fields.- Parameters:
zeroLengthBoundary
- fixed alignment size as number of bytes for a bit-field which follows a zero-length bit-field. A value of 0 causes zero-length type size to be used.
-
encode
Output the details of this bitfield packing to a encoded document formatter.- Parameters:
encoder
- the output document encoder.- Throws:
IOException
- if an IO error occurs while encoding/writing output
-
restoreXml
Restore settings from a<bitfield_packing>
tag in an XML stream. The XML is designed to override existing settings from the default constructor- Parameters:
parser
- is the XML stream
-
hashCode
public int hashCode() -
equals
-