Package ghidra.program.model.data
Interface DataOrganization
- All Known Implementing Classes:
DataOrganizationImpl
public interface DataOrganization
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
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.Get the composite bitfield packing information associated with this data organization.int
int
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
Gets the default alignment to be used for a pointer that doesn't have size.int
int
getIntegerCTypeApproximation
(int size, boolean signed) Returns the best fitting integer C-type whose size is less-than-or-equal to the specified size.int
int
int
int
int
Gets the maximum useful alignment for the target machineint
Shift amount affects interpretation of in-memory pointer values only and will also be reflected within instruction pcode.int
int
int
getSizeAlignment
(int size) Gets the primitive data alignment that is defined for the specified size.int
Gets the number of sizes that have an alignment specified.int[]
getSizes()
Gets the ordered list of sizes that have an alignment specified.int
boolean
default boolean
Determine if this DataOrganization is equivalent to another specific instanceboolean
-
Field Details
-
NO_MAXIMUM_ALIGNMENT
static final int NO_MAXIMUM_ALIGNMENT- See Also:
-
-
Method Details
-
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 encoding size of a float primitive data type in bytes.
-
getDoubleSize
int getDoubleSize()- Returns:
- the encoding size of a double primitive data type in bytes.
-
getLongDoubleSize
int getLongDoubleSize()- Returns:
- the encoding 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) Gets the primitive data alignment that is defined for the specified size. If no entry has been defined for the specified size alignment of the next smaller map entry will be returned. If the map is empty thedefault alignment
. The returned value will not exceed thedefined maximum alignment
.- Parameters:
size
- the primitive data size- Returns:
- the alignment of the data type.
-
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 ordered list of sizes that have an alignment specified.- Returns:
- the ordered list of sizes with alignments mapped to them.
-
getIntegerCTypeApproximation
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
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
-
isEquivalent
Determine if this DataOrganization is equivalent to another specific instance- Parameters:
obj
- is the other instance- Returns:
- true if they are equivalent
-