Class ValueLayout.OfFloat

java.lang.Object
jdk.incubator.foreign.ValueLayout
jdk.incubator.foreign.ValueLayout.OfFloat
All Implemented Interfaces:
Constable, MemoryLayout
Enclosing class:
ValueLayout

public static final class ValueLayout.OfFloat extends ValueLayout
A value layout whose carrier is float.class.
  • Method Details

    • withName

      public ValueLayout.OfFloat withName(String name)
      Description copied from interface: MemoryLayout
      Creates a new layout which features the desired layout name.
      Specified by:
      withName in interface MemoryLayout
      Parameters:
      name - the layout name.
      Returns:
      a new layout which is the same as this layout, except for the name associated with it.
      See Also:
    • withBitAlignment

      public ValueLayout.OfFloat withBitAlignment(long alignmentBits)
      Description copied from interface: MemoryLayout
      Creates a new layout which features the desired alignment constraint.
      Specified by:
      withBitAlignment in interface MemoryLayout
      Parameters:
      alignmentBits - the layout alignment constraint, expressed in bits.
      Returns:
      a new layout which is the same as this layout, except for the alignment constraint associated with it.
    • withOrder

      public ValueLayout.OfFloat withOrder(ByteOrder order)
      Description copied from class: ValueLayout
      Returns a new value layout with given byte order.
      Overrides:
      withOrder in class ValueLayout
      Parameters:
      order - the desired byte order.
      Returns:
      a new value layout with given byte order.
    • name

      public final Optional<String> name()
      Description copied from interface: MemoryLayout
      Returns the name (if any) associated with this layout.
      Specified by:
      name in interface MemoryLayout
      Returns:
      the name (if any) associated with this layout
      See Also:
    • bitAlignment

      public final long bitAlignment()
      Description copied from interface: MemoryLayout
      Returns the alignment constraint associated with this layout, expressed in bits. Layout alignment defines a power of two A which is the bit-wise alignment of the layout. If A <= 8 then A/8 is the number of bytes that must be aligned for any pointer that correctly points to this layout. Thus:
      • A=8 means unaligned (in the usual sense), which is common in packets.
      • A=64 means word aligned (on LP64), A=32 int aligned, A=16 short aligned, etc.
      • A=512 is the most strict alignment required by the x86/SV ABI (for AVX-512 data).
      If no explicit alignment constraint was set on this layout (see MemoryLayout.withBitAlignment(long)), then this method returns the natural alignment constraint (in bits) associated with this layout.
      Specified by:
      bitAlignment in interface MemoryLayout
      Returns:
      the layout alignment constraint, in bits.
    • byteSize

      public long byteSize()
      Description copied from interface: MemoryLayout
      Returns the layout size, in bytes.
      Specified by:
      byteSize in interface MemoryLayout
      Returns:
      the layout size, in bytes
    • hasSize

      public boolean hasSize()
      Description copied from interface: MemoryLayout
      Returns true if this layout has a specified size. A layout does not have a specified size if it is (or contains) a sequence layout whose size is unspecified (see SequenceLayout.elementCount()). Value layouts (see ValueLayout) and padding layouts (see MemoryLayout.paddingLayout(long)) always have a specified size, therefore this method always returns true in these cases.
      Specified by:
      hasSize in interface MemoryLayout
      Returns:
      true, if this layout has a specified size.
    • bitSize

      public long bitSize()
      Description copied from interface: MemoryLayout
      Returns the layout size, in bits.
      Specified by:
      bitSize in interface MemoryLayout
      Returns:
      the layout size, in bits
    • isPadding

      public boolean isPadding()
      Description copied from interface: MemoryLayout
      Returns true, if this layout is a padding layout.
      Specified by:
      isPadding in interface MemoryLayout
      Returns:
      true, if this layout is a padding layout