Package ghidra.program.model.data
Interface DataOrganization
-
- All Known Implementing Classes:
DataOrganizationImpl
public interface DataOrganization
-
-
Field Summary
Fields Modifier and Type Field Description static int
NO_MAXIMUM_ALIGNMENT
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
getAbsoluteMaxAlignment()
Gets the maximum alignment value that is allowed by this data organization.int
getAlignment(DataType dataType)
Determines the alignment value for the indicated data type.BitFieldPacking
getBitFieldPacking()
Get the composite bitfield packing information associated with this data organization.int
getCharSize()
int
getDefaultAlignment()
Gets the default alignment to be used for any data type that isn't a structure, union, array, pointer, type definition, and whose size isn't in the size/alignment map.int
getDefaultPointerAlignment()
Gets the default alignment to be used for a pointer that doesn't have size.int
getDoubleSize()
int
getFloatSize()
java.lang.String
getIntegerCTypeApproximation(int size, boolean signed)
Returns the best fitting integer C-type whose size is less-than-or-equal to the specified size.int
getIntegerSize()
int
getLongDoubleSize()
int
getLongLongSize()
int
getLongSize()
int
getMachineAlignment()
Gets the maximum useful alignment for the target machineint
getPointerShift()
Shift amount affects interpretation of in-memory pointer values only and will also be reflected within instruction pcode.int
getPointerSize()
int
getShortSize()
int
getSizeAlignment(int size)
Gets the alignment that is defined for a data type of the indicated size if one is defined.int
getSizeAlignmentCount()
Gets the number of sizes that have an alignment specified.int[]
getSizes()
Gets the sizes that have an alignment specified.int
getWideCharSize()
boolean
isBigEndian()
boolean
isSignedChar()
-
-
-
Field Detail
-
NO_MAXIMUM_ALIGNMENT
static final int NO_MAXIMUM_ALIGNMENT
- See Also:
- Constant Field Values
-
-
Method Detail
-
isBigEndian
boolean isBigEndian()
- Returns:
- true if data stored big-endian byte order
-
getPointerSize
int getPointerSize()
- Returns:
- the size of a pointer data type in bytes.
-
getPointerShift
int getPointerShift()
Shift amount affects interpretation of in-memory pointer values only and will also be reflected within instruction pcode. A value of zero indicates that shifted-pointers are not supported.- Returns:
- the left shift amount for shifted-pointers.
-
isSignedChar
boolean isSignedChar()
- Returns:
- true if the "char" type is signed
-
getCharSize
int getCharSize()
- Returns:
- the size of a char (char) primitive data type in bytes.
-
getWideCharSize
int getWideCharSize()
- Returns:
- the size of a wide-char (wchar_t) primitive data type in bytes.
-
getShortSize
int getShortSize()
- Returns:
- the size of a short primitive data type in bytes.
-
getIntegerSize
int getIntegerSize()
- Returns:
- the size of a int primitive data type in bytes.
-
getLongSize
int getLongSize()
- Returns:
- the size of a long primitive data type in bytes.
-
getLongLongSize
int getLongLongSize()
- Returns:
- the size of a long long primitive data type in bytes.
-
getFloatSize
int getFloatSize()
- Returns:
- the size of a float primitive data type in bytes.
-
getDoubleSize
int getDoubleSize()
- Returns:
- the size of a double primitive data type in bytes.
-
getLongDoubleSize
int getLongDoubleSize()
- Returns:
- the size of a long double primitive data type in bytes.
-
getAbsoluteMaxAlignment
int getAbsoluteMaxAlignment()
Gets the maximum alignment value that is allowed by this data organization. When getting an alignment for any data type it will not exceed this value. If NO_MAXIMUM_ALIGNMENT is returned, the data organization isn't specifically limited.- Returns:
- the absolute maximum alignment or NO_MAXIMUM_ALIGNMENT
-
getMachineAlignment
int getMachineAlignment()
Gets the maximum useful alignment for the target machine- Returns:
- the machine alignment
-
getDefaultAlignment
int getDefaultAlignment()
Gets the default alignment to be used for any data type that isn't a structure, union, array, pointer, type definition, and whose size isn't in the size/alignment map.- Returns:
- the default alignment to be used if no other alignment can be determined for a data type.
-
getDefaultPointerAlignment
int getDefaultPointerAlignment()
Gets the default alignment to be used for a pointer that doesn't have size.- Returns:
- the default alignment for a pointer
-
getSizeAlignment
int getSizeAlignment(int size) throws NoValueException
Gets the alignment that is defined for a data type of the indicated size if one is defined.- Parameters:
size
- the size of the data type- Returns:
- the alignment of the data type.
- Throws:
NoValueException
- if there isn't an alignment defined for the indicated size.
-
getBitFieldPacking
BitFieldPacking getBitFieldPacking()
Get the composite bitfield packing information associated with this data organization.- Returns:
- composite bitfield packing information
-
getSizeAlignmentCount
int getSizeAlignmentCount()
Gets the number of sizes that have an alignment specified.- Returns:
- the number of sizes with an alignment mapped to them.
-
getSizes
int[] getSizes()
Gets the sizes that have an alignment specified.- Returns:
- the sizes with alignments mapped to them.
-
getIntegerCTypeApproximation
java.lang.String getIntegerCTypeApproximation(int size, boolean signed)
Returns the best fitting integer C-type whose size is less-than-or-equal to the specified size. "long long" will be returned for any size larger than "long long";- Parameters:
size
- integer sizesigned
- if false the unsigned modifier will be prepended.- Returns:
- the best fitting
-
getAlignment
int getAlignment(DataType dataType)
Determines the alignment value for the indicated data type. (i.e. how the data type gets aligned within other data types.) NOTE: this method should not be used for bitfields which are highly dependent upon packing for a composite. This method will always return 1 for Dynamic and FactoryDataTypes.- Parameters:
dataType
- the data type- Returns:
- the datatype alignment
-
-