Example #1
0
        public static Span <T> ReadValues <T>(Span <byte> src, out Span <byte> rem)
            where T : struct
        {
            rem = Span <byte> .Empty;
            var tSize = Unsafe.SizeOf <T>();
            var dst   = ByteSpan.ReadValues <T>(src);
            var q     = Math.DivRem(dst.Length, tSize, out int r);

            if (r != 0)
            {
                rem = src.Slice(dst.Length * tSize);
            }
            return(dst);
        }
Example #2
0
 public static Span <T> ReadValues <T>(Span <byte> src)
     where T : struct
 => ByteSpan.ReadValues <T>(src, 0, src.Length / Unsafe.SizeOf <T>());
Example #3
0
 void ISystemEvents.AgentTransitioned(AgentTransition data)
 => AgentTransitioned(2, data.Agent.ServerId, data.Agent.AgentId, data.Timestamp, ByteSpan.FromValue(data).ToArray());
Example #4
0
 public static BitMatrix16 From <T>(Vector256 <T> src)
     where T : struct
 => BitMatrix16.From(ByteSpan.FromValue(src));
Example #5
0
 public static ulong Lookup(uint i)
 => i < Count
      ? ByteSpan.ReadValue <ulong>(RawBytes, (int)(i * 8))
      : Errors.ThrowOutOfRange <ulong>((int)i, 0, Count - 1);