mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-11-26 10:49:21 +00:00
use explicit __thiscall calling convention for member function casts on mingw32
This commit is contained in:
parent
ffd6294943
commit
e303e314f5
@ -47,8 +47,17 @@
|
|||||||
|
|
||||||
#if HAVE_FAST_NV_MEM_FUN
|
#if HAVE_FAST_NV_MEM_FUN
|
||||||
|
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
#define PF_CONVENTION __thiscall
|
||||||
|
#else
|
||||||
|
// TODO set a calling convention on other platforms/compilers where the default cc does not pass obj as first param
|
||||||
|
#define PF_CONVENTION
|
||||||
|
#endif
|
||||||
|
|
||||||
template< class PMF, class PF >
|
template< class PMF, class PF >
|
||||||
inline PF nv_mem_fun_of(PMF pmf) {
|
inline PF nv_mem_fun_of(PMF pmf) {
|
||||||
|
/** Convert member function pointer to a regular function pointer that takes the object as first parameter
|
||||||
|
*/
|
||||||
if (pmf == 0)
|
if (pmf == 0)
|
||||||
return 0;
|
return 0;
|
||||||
union { PMF pmf; uintptr p[MEM_FUN_WORDS]; } x;
|
union { PMF pmf; uintptr p[MEM_FUN_WORDS]; } x;
|
||||||
@ -59,7 +68,7 @@ inline PF nv_mem_fun_of(PMF pmf) {
|
|||||||
template< class R, class T >
|
template< class R, class T >
|
||||||
class nv_mem_fun_t : public std::unary_function<T, R> {
|
class nv_mem_fun_t : public std::unary_function<T, R> {
|
||||||
typedef R (T::*pmf_t)();
|
typedef R (T::*pmf_t)();
|
||||||
typedef R (*pf_t)(T *);
|
typedef R (* PF_CONVENTION pf_t)(T *);
|
||||||
pf_t pf;
|
pf_t pf;
|
||||||
public:
|
public:
|
||||||
nv_mem_fun_t(pmf_t pmf) : pf(nv_mem_fun_of<pmf_t, pf_t>(pmf)) {}
|
nv_mem_fun_t(pmf_t pmf) : pf(nv_mem_fun_of<pmf_t, pf_t>(pmf)) {}
|
||||||
@ -70,7 +79,7 @@ public:
|
|||||||
template< class R, class T >
|
template< class R, class T >
|
||||||
class const_nv_mem_fun_t : public std::unary_function<T, R> {
|
class const_nv_mem_fun_t : public std::unary_function<T, R> {
|
||||||
typedef R (T::*pmf_t)();
|
typedef R (T::*pmf_t)();
|
||||||
typedef R (*pf_t)(T *);
|
typedef R (* PF_CONVENTION pf_t)(T *);
|
||||||
pf_t const pf;
|
pf_t const pf;
|
||||||
public:
|
public:
|
||||||
const_nv_mem_fun_t(pmf_t const pmf) : pf(nv_mem_fun_of<pmf_t, pf_t>(pmf)) {}
|
const_nv_mem_fun_t(pmf_t const pmf) : pf(nv_mem_fun_of<pmf_t, pf_t>(pmf)) {}
|
||||||
@ -81,7 +90,7 @@ public:
|
|||||||
template< class R, class T, class A >
|
template< class R, class T, class A >
|
||||||
class nv_mem_fun1_t : public std::binary_function<T, A, R> {
|
class nv_mem_fun1_t : public std::binary_function<T, A, R> {
|
||||||
typedef R (T::*pmf_t)(A);
|
typedef R (T::*pmf_t)(A);
|
||||||
typedef R (*pf_t)(T *, A x);
|
typedef R (* PF_CONVENTION pf_t)(T *, A x);
|
||||||
pf_t pf;
|
pf_t pf;
|
||||||
public:
|
public:
|
||||||
nv_mem_fun1_t(pmf_t pmf) : pf(nv_mem_fun_of<pmf_t, pf_t>(pmf)) {}
|
nv_mem_fun1_t(pmf_t pmf) : pf(nv_mem_fun_of<pmf_t, pf_t>(pmf)) {}
|
||||||
@ -92,7 +101,7 @@ public:
|
|||||||
template< class R, class T, class A >
|
template< class R, class T, class A >
|
||||||
class const_nv_mem_fun1_t : public std::binary_function<T, A, R> {
|
class const_nv_mem_fun1_t : public std::binary_function<T, A, R> {
|
||||||
typedef R (T::*pmf_t)(A);
|
typedef R (T::*pmf_t)(A);
|
||||||
typedef R (*pf_t)(T *, A x);
|
typedef R (* PF_CONVENTION pf_t)(T *, A x);
|
||||||
pf_t const pf;
|
pf_t const pf;
|
||||||
public:
|
public:
|
||||||
const_nv_mem_fun1_t(pmf_t const pmf) : pf(nv_mem_fun_of<pmf_t, pf_t>(pmf)) {}
|
const_nv_mem_fun1_t(pmf_t const pmf) : pf(nv_mem_fun_of<pmf_t, pf_t>(pmf)) {}
|
||||||
|
Loading…
Reference in New Issue
Block a user