| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static < the type, annotated by T extends PointerBase> TCStruct annotation | |
| public static < the type, annotated by T extends PointerBase> TCStruct annotation | Returns: pointer to on-stack allocated location for the requested structurenumber of array elements to allocate numberOfElements, Class<T> the requested structure class - must be a compile time constant structType)Reserves a block of memory for array of given |
| public static <T extends PointerBase> T | |
| public static <T extends PointerBase> T |
| StackValue | back to summary |
|---|---|
| private StackValue() | |
| get | back to summary |
|---|---|
| public static <T extends PointerBase> T get(Class<T> structType) Reserves a block of memory for given
ComplexValue numberOnStack = StackValue.get(
SizeOf.get(ComplexValue.class));
It can be used to allocate a structure on the stack. The following example allocates a
ComplexValue and then sends it as a regular parameter to another function to compute
absolute value of the number:
ComplexValue numberOnStack = StackValue.get(ComplexValue.class); numberOnStack.realPart(3.0); numberOnStack.imagineryPart(4.0); double absoluteValue = absoluteValue(numberOnStack); assert 5.0 == absoluteValue;
| |
| get | back to summary |
|---|---|
| public static <T extends PointerBase> T get(int numberOfElements, Class<T> structType) Reserves a block of memory for array of given
IntOrDouble arrayOnStack = StackValue.get(
3, // number of array elements
SizeOf.get(IntOrDouble.class));
It can be used to allocate a array of parameters on the stack. The following example
allocates a three element array, fills them with two int values and one double value and then
sends it to a method that accepts such parameter convention:
IntOrDouble array = StackValue.get(3, IntOrDouble.class); array.addressOf(0).i(10); array.addressOf(2).i(12); array.addressOf(3).d(20.0); double sum = acceptIntIntDouble(array);
| |
| get | back to summary |
|---|---|
| public static <T extends PointerBase> T get(int size) Reserves a block of memory in the stack frame of the method that calls this intrinsic. The
returned pointer is aligned to the same alignment required by the operating system for stack
frames. If the requested size is 0, the method returns
| |
| get | back to summary |
|---|---|
| public static <T extends PointerBase> T get(int numberOfElements, int elementSize) Utility method that performs size arithmetic, otherwise equivalent to
| |