summaryrefslogtreecommitdiff
path: root/src/vm/argslot.h
blob: 9729227eeda6940689859a591fe14d911f0719d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// ============================================================================
// File: argslot.h
//

// ============================================================================
// Contains the ARG_SLOT type.


#ifndef __ARG_SLOT_H__
#define __ARG_SLOT_H__

// The ARG_SLOT must be big enough to represent all pointer and basic types (except for 80-bit fp values).
// So, it's guaranteed to be at least 64-bit.
typedef unsigned __int64 ARG_SLOT;
#define SIZEOF_ARG_SLOT 8

#if BIGENDIAN
// Returns the address of the payload inside the argslot
inline BYTE* ArgSlotEndianessFixup(ARG_SLOT* pArg, UINT cbSize) {
    LIMITED_METHOD_CONTRACT;

    BYTE* pBuf = (BYTE*)pArg;
    switch (cbSize) {
    case 1:
        pBuf += 7;
        break;
    case 2:
        pBuf += 6;
        break;
    case 4:
        pBuf += 4;
        break;
    }
    return pBuf;
}
#else
#define ArgSlotEndianessFixup(pArg, cbSize) ((BYTE *)(pArg))
#endif

#endif  // __ARG_SLOT_H__