public void CopyTo(VectorSegment <byte> vs) { var bytes = this.GetBytes(); for (var i = 0; i < vs.Length; i++) { vs[i] = bytes[i]; } }
public static short ToInt16(this VectorSegment <byte> vs) { if (vs.Length != 2) { throw new InvalidOperationException("Vector segment length must be exactly 2"); } short n = 0, i = 16; foreach (var b in vs) { n += (short)(b << (i -= 8)); } return(n); }
public static int ToInt32(this VectorSegment <byte> vs) { if (vs.Length != 4) { throw new InvalidOperationException("Vector segment length must be exactly 4"); } int n = 0, i = 32; foreach (var b in vs) { n += b << (i -= 8); } return(n); }
public static int Read(this VectorSegment <byte> vs, Stream s) { return(s.Read(vs)); }
public static int Read(this Stream s, VectorSegment <byte> vs) { return(s.Read(vs.array, vs.offset, vs.length)); }
public Enumerator(VectorSegment <T> vs) { this.vs = vs; this.current = -1; }