예제 #1
0
        public unsafe ReadOnlySpan <C> AcquireSpan <C>() where C : struct, IEquatable <T>, IComparable <T>, IConvertible
        {
            int size = checked ((int)(Size / (ulong)JemUtil.SizeOfStruct <C>()));

            if (size == 0)
            {
                throw new ArgumentException($"Type {typeof(T).Name} is too small to be reinterpreted as {typeof(C).Name}.");
            }
            else
            {
                Acquire();
                return(new ReadOnlySpan <C>((void *)_Ptr, size));
            }
        }
예제 #2
0
 public static uint ElementSizeInBytes <T>() where T : struct => (uint)JemUtil.SizeOfStruct <T>();