| 1 | // Licensed to the .NET Foundation under one or more agreements. |
| 2 | // The .NET Foundation licenses this file to you under the MIT license. |
| 3 | // See the LICENSE file in the project root for more information. |
| 4 | // ============================================================================ |
| 5 | // File: argslot.h |
| 6 | // |
| 7 | |
| 8 | // ============================================================================ |
| 9 | // Contains the ARG_SLOT type. |
| 10 | |
| 11 | |
| 12 | #ifndef __ARG_SLOT_H__ |
| 13 | #define __ARG_SLOT_H__ |
| 14 | |
| 15 | // The ARG_SLOT must be big enough to represent all pointer and basic types (except for 80-bit fp values). |
| 16 | // So, it's guaranteed to be at least 64-bit. |
| 17 | typedef unsigned __int64 ARG_SLOT; |
| 18 | #define SIZEOF_ARG_SLOT 8 |
| 19 | |
| 20 | #if BIGENDIAN |
| 21 | // Returns the address of the payload inside the argslot |
| 22 | inline BYTE* ArgSlotEndianessFixup(ARG_SLOT* pArg, UINT cbSize) { |
| 23 | LIMITED_METHOD_CONTRACT; |
| 24 | |
| 25 | BYTE* pBuf = (BYTE*)pArg; |
| 26 | switch (cbSize) { |
| 27 | case 1: |
| 28 | pBuf += 7; |
| 29 | break; |
| 30 | case 2: |
| 31 | pBuf += 6; |
| 32 | break; |
| 33 | case 4: |
| 34 | pBuf += 4; |
| 35 | break; |
| 36 | } |
| 37 | return pBuf; |
| 38 | } |
| 39 | #else |
| 40 | #define ArgSlotEndianessFixup(pArg, cbSize) ((BYTE *)(pArg)) |
| 41 | #endif |
| 42 | |
| 43 | #endif // __ARG_SLOT_H__ |
| 44 | |