public byte GetMinByteSize() => 32; // of byte sized of fields (exclude extended) public void Deserialize(ref ReadOnlySpan <byte> buffer, int payloadSize) { var index = 0; var endIndex = payloadSize; var arraySize = 0; Usec = BinSerialize.ReadULong(ref buffer); index += 8; Accel0 = BinSerialize.ReadFloat(ref buffer); index += 4; Accel1 = BinSerialize.ReadFloat(ref buffer); index += 4; Accel2 = BinSerialize.ReadFloat(ref buffer); index += 4; Gyro0 = BinSerialize.ReadFloat(ref buffer); index += 4; Gyro1 = BinSerialize.ReadFloat(ref buffer); index += 4; Gyro2 = BinSerialize.ReadFloat(ref buffer); index += 4; }
public byte GetMinByteSize() => 179; // of byte sized of fields (exclude extended) public void Deserialize(ref ReadOnlySpan <byte> buffer, int payloadSize) { var index = 0; var endIndex = payloadSize; var arraySize = 0; U64 = BinSerialize.ReadULong(ref buffer); index += 8; S64 = BinSerialize.ReadLong(ref buffer); index += 8; D = BinSerialize.ReadDouble(ref buffer); index += 8; arraySize = /*ArrayLength*/ 3 - Math.Max(0, ((/*PayloadByteSize*/ 179 - payloadSize - /*ExtendedFieldsLength*/ 0) / 8 /*FieldTypeByteSize*/)); U64Array = new ulong[arraySize]; for (var i = 0; i < arraySize; i++) { U64Array[i] = BinSerialize.ReadULong(ref buffer); index += 8; } arraySize = 3; for (var i = 0; i < arraySize; i++) { S64Array[i] = BinSerialize.ReadLong(ref buffer); index += 8; } arraySize = 3; for (var i = 0; i < arraySize; i++) { DArray[i] = BinSerialize.ReadDouble(ref buffer); index += 8; } U32 = BinSerialize.ReadUInt(ref buffer); index += 4; S32 = BinSerialize.ReadInt(ref buffer); index += 4; F = BinSerialize.ReadFloat(ref buffer); index += 4; arraySize = 3; for (var i = 0; i < arraySize; i++) { U32Array[i] = BinSerialize.ReadUInt(ref buffer); index += 4; } arraySize = 3; for (var i = 0; i < arraySize; i++) { S32Array[i] = BinSerialize.ReadInt(ref buffer); index += 4; } arraySize = 3; for (var i = 0; i < arraySize; i++) { FArray[i] = BinSerialize.ReadFloat(ref buffer); index += 4; } U16 = BinSerialize.ReadUShort(ref buffer); index += 2; S16 = BinSerialize.ReadShort(ref buffer); index += 2; arraySize = 3; for (var i = 0; i < arraySize; i++) { U16Array[i] = BinSerialize.ReadUShort(ref buffer); index += 2; } arraySize = 3; for (var i = 0; i < arraySize; i++) { S16Array[i] = BinSerialize.ReadShort(ref buffer); index += 2; } C = (char)buffer[0]; buffer = buffer.Slice(1); index += 1; arraySize = 10; unsafe { fixed(byte *bytePointer = buffer) fixed(char *charPointer = S) { Encoding.ASCII.GetChars(bytePointer, arraySize, charPointer, S.Length); } } buffer = buffer.Slice(arraySize); index += arraySize; U8 = (byte)BinSerialize.ReadByte(ref buffer); index += 1; S8 = (sbyte)BinSerialize.ReadByte(ref buffer); index += 1; arraySize = 3; for (var i = 0; i < arraySize; i++) { U8Array[i] = (byte)BinSerialize.ReadByte(ref buffer); index += 1; } arraySize = 3; for (var i = 0; i < arraySize; i++) { S8Array[i] = (sbyte)BinSerialize.ReadByte(ref buffer); index += 1; } }