public static sbyte ReadSByte(ByteArray array) { if (!array.HasNext()) { throw new IndexOutOfRangeException(); } return((sbyte)array.Read()); }
public static unsafe char ReadChar(ByteArray array) { if (!array.Has(Sizes.CharLength)) { throw new IndexOutOfRangeException(); } char output; byte *ptr = (byte *)&output; for (int i = 0; i < Sizes.CharLength; i++) { ptr[i] = array.Read(); } return(output); }
public static unsafe ushort ReadUShort(ByteArray array) { if (!array.Has(Sizes.UShortLength)) { throw new IndexOutOfRangeException(); } ushort output; byte * ptr = (byte *)&output; for (int i = 0; i < Sizes.UShortLength; i++) { ptr[i] = array.Read(); } return(output); }
public static unsafe double ReadDouble(ByteArray array) { if (!array.Has(Sizes.DoubleLength)) { throw new IndexOutOfRangeException(); } double output; byte * ptr = (byte *)&output; for (int i = 0; i < Sizes.DoubleLength; i++) { ptr[i] = array.Read(); } return(output); }