예제 #1
0
        public void CopyFrom(ObiNativeList <T> source)
        {
            if (source == null || !isCreated || !source.isCreated)
            {
                throw new ArgumentNullException();
            }

            if (m_Count < source.m_Count)
            {
                throw new ArgumentOutOfRangeException();
            }

            UnsafeUtility.MemCpy(m_AlignedPtr, source.m_AlignedPtr, source.count * m_Stride);
        }
예제 #2
0
        public bool Compare(ObiNativeList <T> other)
        {
            if (other == null || !isCreated || !other.isCreated)
            {
                throw new ArgumentNullException();
            }

            if (m_Count != other.m_Count)
            {
                return(false);
            }

            return(UnsafeUtility.MemCmp(m_AlignedPtr, other.m_AlignedPtr, m_Count * m_Stride) == 0);
        }
예제 #3
0
        public void CopyFrom(ObiNativeList <T> other)
        {
            if (other == null)
            {
                throw new ArgumentNullException();
            }

            if (m_Count < other.m_Count)
            {
                throw new ArgumentException();
            }

            unsafe
            {
                UnsafeUtility.MemCpy(m_AlignedPtr, other.m_AlignedPtr, other.count * m_Stride);
            }
        }
예제 #4
0
        public void CopyFrom(ObiNativeList <T> source, int sourceIndex, int destIndex, int length)
        {
            if (source == null || !isCreated || !source.isCreated)
            {
                throw new ArgumentNullException();
            }

            if (length <= 0 || source.m_Count == 0)
            {
                return;
            }

            if (sourceIndex >= source.m_Count || sourceIndex < 0 || destIndex >= m_Count || destIndex < 0 ||
                sourceIndex + length > source.m_Count || destIndex + length > m_Count)
            {
                throw new ArgumentOutOfRangeException();
            }

            void *sourceAddress = source.AddressOfElement(sourceIndex);
            void *destAddress   = AddressOfElement(destIndex);

            UnsafeUtility.MemCpy(destAddress, sourceAddress, length * m_Stride);
        }