Пример #1
0
            private static void WriteInlineValueOf_7b5996bec77f4c71928769dd75748853 <TSpanWriter>(
                TSpanWriter spanWriter,
                Span <byte> span,
                BenchmarkCore.SortedVectorTable value,
                int offset,
                SerializationContext context) where TSpanWriter : ISpanWriter
            {
                checked
                {
                    int tableStart = context.AllocateSpace(11, sizeof(int));
                    spanWriter.WriteUOffset(span, offset, tableStart, context);
                    int currentOffset = tableStart + sizeof(int); // skip past vtable soffset_t.

                    int         vtableLength = 4;
                    Span <byte> vtable       = stackalloc byte[6];

                    var index0Value  = value.Vector;
                    var index0Offset = tableStart;

                    if (!(index0Value is null))
                    {
                        currentOffset += SerializationHelpers.GetAlignmentError(currentOffset, 4);
                        index0Offset   = currentOffset;
                        currentOffset += 4;


                        if (6 > vtableLength)
                        {
                            vtableLength = 6;
                        }
                    }
                    spanWriter.WriteUShort(vtable, (ushort)(index0Offset - tableStart), 4, context);
                    int tableLength = currentOffset - tableStart;
                    context.Offset -= 11 - tableLength;
                    spanWriter.WriteUShort(vtable, (ushort)vtableLength, 0, context);
                    spanWriter.WriteUShort(vtable, (ushort)tableLength, sizeof(ushort), context);
                    int vtablePosition = context.FinishVTable(span, vtable.Slice(0, vtableLength));
                    spanWriter.WriteInt(span, tableStart - vtablePosition, tableStart, context);

                    if (index0Offset != tableStart)
                    {
                        WriteInlineValueOf_36d43cc8bc8e4fbd92e5d1e6822467b6(
                            spanWriter,
                            span,
                            index0Value !,
                            index0Offset,
                            context);

                        context.AddPostSerializeAction(
                            (tempSpan, ctx) =>
                            SortedVectorHelpers.SortVector(
                                tempSpan,
                                index0Offset,
                                0,
                                4,
                                new FlatSharp.IntSpanComparer(default(System.Int32))));
                    }
                }
            }