Package ghidra.program.model.data

# Interface DataOrganization

All Known Implementing Classes:
  `DataOrganizationImpl`

public interface DataOrganization

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `NO_MAXIMUM_ALIGNMENT`

- ## Method Summary

  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()`
  `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 machine
  `int`
  `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 primitive data alignment that is defined for the specified size.
  `int`
  `getSizeAlignmentCount()`
  Gets the number of sizes that have an alignment specified.
  `int[]`
  `getSizes()`
  Gets the ordered list of sizes that have an alignment specified.
  `int`
  `getWideCharSize()`
  `boolean`
  `isBigEndian()`
  `default boolean`
  `isEquivalent(DataOrganization obj)`
  Determine if this DataOrganization is equivalent to another specific instance
  `boolean`
  `isSignedChar()`

- ## Field Details

  - ### NO_MAXIMUM_ALIGNMENT

    static final int NO_MAXIMUM_ALIGNMENT
    See Also:
      - Constant Field Values

- ## 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 the `default alignment`. The returned value will not exceed the `defined 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

    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 size
      `signed` - 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

  - ### isEquivalent

    default boolean isEquivalent(DataOrganization obj)
    Determine if this DataOrganization is equivalent to another specific instance
    Parameters:
      `obj` - is the other instance
    Returns:
      true if they are equivalent