FlatBuffers.ByteBuffer.GetFloat C# (CSharp) Method

GetFloat() public method

public GetFloat ( int offset ) : float
offset int
return float
        public unsafe float GetFloat(int offset)
        {
            AssertOffsetAndLength(offset, sizeof(float));
            fixed (byte* ptr = _buffer)
            {
                if (BitConverter.IsLittleEndian)
                {
                    return *(float*)(ptr + offset);
                }
                else
                {
                    uint uvalue = ReverseBytes(*(uint*)(ptr + offset));
                    return *(float*)(&uvalue);
                }
            }
        }

Usage Example

Example #1
0
 public bool MoveNext()
 {
     if (_pos >= _end)
     {
         return(false);
     }
     Current = _buffer.GetFloat(_pos);
     _pos   += Size;
     return(true);
 }
All Usage Examples Of FlatBuffers.ByteBuffer::GetFloat