/// <summary> /// Sets the specified value. /// </summary> /// <param name="positionInBytes">Relative position in bytes from the beginning of the buffer to set the data to.</param> /// <param name="value">The value.</param> public void Set(int positionInBytes, Half2 value) { unsafe { *((Half2 *)(_buffer + positionInBytes)) = value; } }
public unsafe void Write(Half2 value) { if (!this._canWrite) { throw new NotSupportedException(); } *(Half2 *)(this._buffer + this._position) = value; this._position += 4L; }
public unsafe Half2 ReadHalf2() { if (!this._canRead) { throw new NotSupportedException(); } Half2 half2 = *(Half2 *)(this._buffer + this._position); this._position += 4L; return(half2); }
/// <summary> /// Writes the specified value. /// </summary> /// <remarks> /// In order to provide faster read/write, this operation doesn't check stream bound. /// A client must carefully not read/write above the size of this datastream. /// </remarks> /// <param name="value">The value.</param> public void Write(Half2 value) { if (!_canWrite) { throw new NotSupportedException(); } unsafe { *((Half2 *)(_buffer + _position)) = value; _position += 2 * 2; } }
/// <summary> /// Reads a Half2. /// </summary> /// <remarks> /// In order to provide faster read/write, this operation doesn't check stream bound. /// A client must carefully not read/write above the size of this datastream. /// </remarks> /// <returns>an Half2 from the stream</returns> public Half2 ReadHalf2() { unsafe { if (!_canRead) { throw new NotSupportedException(); } Half2 value = *((Half2 *)(_buffer + _position)); _position += 2 * 2; return(value); } }
public unsafe void Set(int positionInBytes, Half2 value) { *(Half2 *)(this._buffer + positionInBytes) = value; }