mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 01:31:08 +00:00
71 lines
1.9 KiB
Text
71 lines
1.9 KiB
Text
|
|
||
|
inline static void*
|
||
|
mframe_arg_addr(arglist_t argf, NSArgumentInfo *info)
|
||
|
{
|
||
|
int offset = info->offset;
|
||
|
#if WORDS_BIGENDIAN
|
||
|
if (info->size < sizeof(int))
|
||
|
offset += sizeof(int) - info->size;
|
||
|
#endif
|
||
|
if (info->isReg)
|
||
|
return(argf->arg_regs + offset);
|
||
|
else
|
||
|
return(argf->arg_ptr + offset);
|
||
|
}
|
||
|
|
||
|
inline static void
|
||
|
mframe_get_arg(arglist_t argf, NSArgumentInfo *info, void* buffer)
|
||
|
{
|
||
|
#if MFRAME_STRUCT_BYREF
|
||
|
const char *typ = info->type;
|
||
|
|
||
|
/*
|
||
|
* If structures are passed in the stack frame by reference - we need
|
||
|
* to copy the actual structure, rather than it's pointer.
|
||
|
*/
|
||
|
if (*typ == _C_STRUCT_B || *typ == _C_UNION_B || *typ == _C_ARY_B) {
|
||
|
memcpy(buffer, *(void**)mframe_arg_addr(argf, info), info->size);
|
||
|
}
|
||
|
else
|
||
|
#endif
|
||
|
memcpy(buffer, mframe_arg_addr(argf, info), info->size);
|
||
|
}
|
||
|
|
||
|
inline static void
|
||
|
mframe_set_arg(arglist_t argf, NSArgumentInfo *info, void* buffer)
|
||
|
{
|
||
|
#if MFRAME_STRUCT_BYREF
|
||
|
const char *typ = info->type;
|
||
|
|
||
|
/*
|
||
|
* If structures are passed in the stack frame by reference - we need
|
||
|
* to copy a pointer onto the stack rather than the actual structure.
|
||
|
*/
|
||
|
if (*typ == _C_STRUCT_B || *typ == _C_UNION_B || *typ == _C_ARY_B) {
|
||
|
memcpy(mframe_arg_addr(argf, info), &buffer, sizeof(void*));
|
||
|
}
|
||
|
else
|
||
|
#endif
|
||
|
memcpy(mframe_arg_addr(argf, info), buffer, info->size);
|
||
|
}
|
||
|
|
||
|
inline static void
|
||
|
mframe_cpy_arg(arglist_t dst, arglist_t src, NSArgumentInfo *info)
|
||
|
{
|
||
|
#if MFRAME_STRUCT_BYREF
|
||
|
const char *typ = info->type;
|
||
|
|
||
|
/*
|
||
|
* If structures are passed in the stack frame by reference - we need
|
||
|
* to copy a pointer onto the stack rather than the actual structure.
|
||
|
*/
|
||
|
if (*typ == _C_STRUCT_B || *typ == _C_UNION_B || *typ == _C_ARY_B) {
|
||
|
memcpy(mframe_arg_addr(dst, info), mframe_arg_addr(src, info), sizeof(void*));
|
||
|
}
|
||
|
else
|
||
|
#endif
|
||
|
memcpy(mframe_arg_addr(dst, info), mframe_arg_addr(src, info), info->size);
|
||
|
}
|
||
|
|
||
|
#endif /* __mframe_h_GNUSTEP_BASE_INCLUDE */
|