mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-30 14:50:03 +00:00
Add element size parameter to __vector_as_arraysegment [c#] (#5512)
* Add element size parameter to __vector_as_arraysegment Add element size parameter to __vector_as_arraysegment fixing issue where VectorAsBytes returns incorrect size span for multibyte element types. * Update codegen Update codegen and Table to return typed span. * update test files update test files
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
b5560fcd52
commit
2706381eef
@@ -38,7 +38,7 @@ public struct MonsterExtra : IFlatbufferObject
|
||||
public double Dvec(int j) { int o = __p.__offset(20); return o != 0 ? __p.bb.GetDouble(__p.__vector(o) + j * 8) : (double)0; }
|
||||
public int DvecLength { get { int o = __p.__offset(20); return o != 0 ? __p.__vector_len(o) : 0; } }
|
||||
#if ENABLE_SPAN_T
|
||||
public Span<byte> GetDvecBytes() { return __p.__vector_as_span(20); }
|
||||
public Span<double> GetDvecBytes() { return __p.__vector_as_span<double>(20, 8); }
|
||||
#else
|
||||
public ArraySegment<byte>? GetDvecBytes() { return __p.__vector_as_arraysegment(20); }
|
||||
#endif
|
||||
@@ -47,7 +47,7 @@ public struct MonsterExtra : IFlatbufferObject
|
||||
public float Fvec(int j) { int o = __p.__offset(22); return o != 0 ? __p.bb.GetFloat(__p.__vector(o) + j * 4) : (float)0; }
|
||||
public int FvecLength { get { int o = __p.__offset(22); return o != 0 ? __p.__vector_len(o) : 0; } }
|
||||
#if ENABLE_SPAN_T
|
||||
public Span<byte> GetFvecBytes() { return __p.__vector_as_span(22); }
|
||||
public Span<float> GetFvecBytes() { return __p.__vector_as_span<float>(22, 4); }
|
||||
#else
|
||||
public ArraySegment<byte>? GetFvecBytes() { return __p.__vector_as_arraysegment(22); }
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user