working on initStructListPointer
This commit is contained in:
parent
e81d28c979
commit
d87672e8dc
4 changed files with 26 additions and 0 deletions
|
@ -14,4 +14,9 @@ final class ListPointer {
|
|||
public static int inlineCompositeWordCount(int elementSizeAndCount) {
|
||||
return elementCount(elementSizeAndCount);
|
||||
}
|
||||
|
||||
public static void setInlineComposite(ByteBuffer buffer, int offset, int wordCount) {
|
||||
buffer.putInt(8 * offset + 4,
|
||||
(wordCount << 3) | FieldSize.INLINE_COMPOSITE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,4 +14,9 @@ final class StructPointer{
|
|||
public static int wordSize(int structRef) {
|
||||
return (int)dataSize(structRef) + (int)ptrCount(structRef);
|
||||
}
|
||||
|
||||
public static void setFromStructSize(ByteBuffer buffer, int offset, StructSize size) {
|
||||
// buffer.putInt(8 * offset + 4,
|
||||
throw new Error("unimplemented");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,6 +44,15 @@ final class WireHelpers {
|
|||
|
||||
int wordsPerElement = elementSize.total();
|
||||
|
||||
//# Allocate the list, prefixed by a single WirePointer.
|
||||
int wordCount = elementCount * wordsPerElement;
|
||||
int ptrOffset = allocate(refOffset, segment, 1 + wordCount, WirePointer.LIST);
|
||||
|
||||
//# Initialize the pointer.
|
||||
ListPointer.setInlineComposite(segment.buffer, refOffset, wordCount);
|
||||
WirePointer.setKindAndInlineCompositeListElementCount(segment.buffer, ptrOffset,
|
||||
WirePointer.STRUCT, elementCount);
|
||||
|
||||
throw new Error("unimplemented");
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,13 @@ final class WirePointer {
|
|||
return offsetAndKind(wirePointer) >> 2;
|
||||
}
|
||||
|
||||
public static void setKindAndInlineCompositeListElementCount(ByteBuffer buffer,
|
||||
int offset,
|
||||
byte kind,
|
||||
int elementCount) {
|
||||
buffer.putInt(offset * 8, (elementCount << 2) | kind);
|
||||
}
|
||||
|
||||
public static int upper32Bits(long wirePointer) {
|
||||
return (int)(wirePointer >> 32);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue