diff options
Diffstat (limited to 'src/classlibnative/bcltype/arraynative.cpp')
-rw-r--r-- | src/classlibnative/bcltype/arraynative.cpp | 41 |
1 files changed, 9 insertions, 32 deletions
diff --git a/src/classlibnative/bcltype/arraynative.cpp b/src/classlibnative/bcltype/arraynative.cpp index b813b71638..d05f0ca1fb 100644 --- a/src/classlibnative/bcltype/arraynative.cpp +++ b/src/classlibnative/bcltype/arraynative.cpp @@ -1070,48 +1070,25 @@ FCIMPL6(void, ArrayNative::ArrayCopy, ArrayBase* m_pSrc, INT32 m_iSrcIndex, Arra FCIMPLEND -FCIMPL3(void, ArrayNative::ArrayClear, ArrayBase* pArrayUNSAFE, INT32 iIndex, INT32 iLength) +FCIMPL5(void*, ArrayNative::GetRawArrayGeometry, ArrayBase* pArray, UINT32* pNumComponents, UINT32* pElementSize, INT32* pLowerBound, CLR_BOOL* pContainsGCPointers) { - FCALL_CONTRACT; - - BASEARRAYREF pArray = (BASEARRAYREF)pArrayUNSAFE; - - HELPER_METHOD_FRAME_BEGIN_1(pArray); - - // cannot pass null for array - if (pArray == NULL) - COMPlusThrowArgumentNull(W("array"), W("ArgumentNull_Array")); - - // array must be an array - _ASSERTE(pArray->GetMethodTable()->IsArray()); - - // array bounds checking - int lb = pArray->GetLowerBoundsPtr()[0]; - if (iIndex < lb || (iIndex - lb) < 0 || iLength < 0) - COMPlusThrow(kIndexOutOfRangeException); + VALIDATEOBJECT(pArray); - if ((iIndex - lb) > (int)pArray->GetNumComponents() - iLength) - COMPlusThrow(kIndexOutOfRangeException); + _ASSERTE(pArray != NULL); - if (iLength > 0) - { - char* array = (char*)pArray->GetDataPtr(); - - SIZE_T size = pArray->GetComponentSize(); - _ASSERTE(size >= 1); + MethodTable *pMT = pArray->GetMethodTable(); - ZeroMemoryInGCHeap(array + (iIndex - lb) * size, iLength * size); - } + *pNumComponents = pArray->GetNumComponents(); + *pElementSize = pMT->RawGetComponentSize(); + *pLowerBound = pArray->GetLowerBoundsPtr()[0]; + *pContainsGCPointers = !!pMT->ContainsPointers(); - HELPER_METHOD_FRAME_END(); + return (BYTE*)pArray + ArrayBase::GetDataPtrOffset(pMT); } FCIMPLEND - - - // Check we're allowed to create an array with the given element type. void ArrayNative::CheckElementType(TypeHandle elementType) { |