java.lang.Object
jdk.incubator.foreign.ValueLayout
jdk.incubator.foreign.ValueLayout.OfShort
- All Implemented Interfaces:
Constable
,MemoryLayout
- Enclosing class:
ValueLayout
A value layout whose carrier is
short.class
.-
Nested Class Summary
Nested classes/interfaces declared in class jdk.incubator.foreign.ValueLayout
ValueLayout.OfAddress, ValueLayout.OfBoolean, ValueLayout.OfByte, ValueLayout.OfChar, ValueLayout.OfDouble, ValueLayout.OfFloat, ValueLayout.OfInt, ValueLayout.OfLong, ValueLayout.OfShort
Nested classes/interfaces declared in interface jdk.incubator.foreign.MemoryLayout
MemoryLayout.PathElement
-
Field Summary
Fields declared in class jdk.incubator.foreign.ValueLayout
ADDRESS, JAVA_BOOLEAN, JAVA_BYTE, JAVA_CHAR, JAVA_DOUBLE, JAVA_FLOAT, JAVA_INT, JAVA_LONG, JAVA_SHORT
-
Method Summary
Modifier and TypeMethodDescriptionfinal long
Returns the alignment constraint associated with this layout, expressed in bits.long
bitSize()
Returns the layout size, in bits.long
byteSize()
Returns the layout size, in bytes.boolean
hasSize()
Returnstrue
if this layout has a specified size.boolean
Returns true, if this layout is a padding layout.name()
Returns the name (if any) associated with this layout.withBitAlignment
(long alignmentBits) Creates a new layout which features the desired alignment constraint.Creates a new layout which features the desired layout name.Returns a new value layout with given byte order.Methods declared in class jdk.incubator.foreign.ValueLayout
carrier, describeConstable, equals, hashCode, order, toString
Methods declared in class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods declared in interface jdk.incubator.foreign.MemoryLayout
bitAlignment, bitOffset, bitOffsetHandle, bitSize, byteAlignment, byteOffset, byteOffsetHandle, byteSize, hasSize, isPadding, map, name, select, sliceHandle, varHandle
-
Method Details
-
withName
Description copied from interface:MemoryLayout
Creates a new layout which features the desired layout name.- Specified by:
withName
in interfaceMemoryLayout
- 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
Description copied from interface:MemoryLayout
Creates a new layout which features the desired alignment constraint.- Specified by:
withBitAlignment
in interfaceMemoryLayout
- 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
Description copied from class:ValueLayout
Returns a new value layout with given byte order.- Overrides:
withOrder
in classValueLayout
- Parameters:
order
- the desired byte order.- Returns:
- a new value layout with given byte order.
-
name
Description copied from interface:MemoryLayout
Returns the name (if any) associated with this layout.- Specified by:
name
in interfaceMemoryLayout
- 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 twoA
which is the bit-wise alignment of the layout. IfA <= 8
thenA/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).
MemoryLayout.withBitAlignment(long)
), then this method returns the natural alignment constraint (in bits) associated with this layout.- Specified by:
bitAlignment
in interfaceMemoryLayout
- 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 interfaceMemoryLayout
- Returns:
- the layout size, in bytes
-
hasSize
public boolean hasSize()Description copied from interface:MemoryLayout
Returnstrue
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 (seeSequenceLayout.elementCount()
). Value layouts (seeValueLayout
) and padding layouts (seeMemoryLayout.paddingLayout(long)
) always have a specified size, therefore this method always returnstrue
in these cases.- Specified by:
hasSize
in interfaceMemoryLayout
- 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 interfaceMemoryLayout
- 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 interfaceMemoryLayout
- Returns:
- true, if this layout is a padding layout
-