diff options
author | Ruslan Mustakov <r.mustakov@gmail.com> | 2017-07-19 18:37:05 +0700 |
---|---|---|
committer | Ruslan Mustakov <r.mustakov@gmail.com> | 2017-07-20 11:50:18 +0700 |
commit | 30176b0bb1d6083ecf8ce9e6bfca0dce9240a634 (patch) | |
tree | 7e17bf29de8ee4a2f3b65b5d754493711e13f6d2 /core/method_ptrcall.h | |
parent | 2a0c0db028c84c75f4a927d0fd400449f3236952 (diff) |
Use specific size for numeric types in ptrcall
The script system does not provide information about specific int
sizes, so we should establish convention to use the largest size
(64 bits). For real types double is always used.
Diffstat (limited to 'core/method_ptrcall.h')
-rw-r--r-- | core/method_ptrcall.h | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/core/method_ptrcall.h b/core/method_ptrcall.h index c6dbfc2a7a..ead58c23c8 100644 --- a/core/method_ptrcall.h +++ b/core/method_ptrcall.h @@ -60,37 +60,37 @@ struct PtrToArg { } \ } -#define MAKE_PTRARGR(m_type, m_ret) \ - template <> \ - struct PtrToArg<m_type> { \ - _FORCE_INLINE_ static m_type convert(const void *p_ptr) { \ - return *reinterpret_cast<const m_type *>(p_ptr); \ - } \ - _FORCE_INLINE_ static void encode(m_type p_val, void *p_ptr) { \ - *((m_ret *)p_ptr) = p_val; \ - } \ - }; \ - template <> \ - struct PtrToArg<const m_type &> { \ - _FORCE_INLINE_ static m_type convert(const void *p_ptr) { \ - return *reinterpret_cast<const m_type *>(p_ptr); \ - } \ - _FORCE_INLINE_ static void encode(m_type p_val, void *p_ptr) { \ - *((m_ret *)p_ptr) = p_val; \ - } \ +#define MAKE_PTRARGCONV(m_type, m_conv) \ + template <> \ + struct PtrToArg<m_type> { \ + _FORCE_INLINE_ static m_type convert(const void *p_ptr) { \ + return static_cast<m_type>(*reinterpret_cast<const m_conv *>(p_ptr)); \ + } \ + _FORCE_INLINE_ static void encode(m_type p_val, void *p_ptr) { \ + *((m_conv *)p_ptr) = static_cast<m_conv>(p_val); \ + } \ + }; \ + template <> \ + struct PtrToArg<const m_type &> { \ + _FORCE_INLINE_ static m_type convert(const void *p_ptr) { \ + return static_cast<m_type>(*reinterpret_cast<const m_conv *>(p_ptr)); \ + } \ + _FORCE_INLINE_ static void encode(m_type p_val, void *p_ptr) { \ + *((m_conv *)p_ptr) = static_cast<m_conv>(p_val); \ + } \ } MAKE_PTRARG(bool); -MAKE_PTRARGR(uint8_t, int); -MAKE_PTRARGR(int8_t, int); -MAKE_PTRARGR(uint16_t, int); -MAKE_PTRARGR(int16_t, int); -MAKE_PTRARGR(uint32_t, int); -MAKE_PTRARGR(int32_t, int); -MAKE_PTRARGR(int64_t, int); -MAKE_PTRARGR(uint64_t, int); -MAKE_PTRARG(float); -MAKE_PTRARGR(double, float); +MAKE_PTRARGCONV(uint8_t, int64_t); +MAKE_PTRARGCONV(int8_t, int64_t); +MAKE_PTRARGCONV(uint16_t, int64_t); +MAKE_PTRARGCONV(int16_t, int64_t); +MAKE_PTRARGCONV(uint32_t, int64_t); +MAKE_PTRARGCONV(int32_t, int64_t); +MAKE_PTRARG(int64_t); +MAKE_PTRARG(uint64_t); +MAKE_PTRARGCONV(float, double); +MAKE_PTRARG(double); MAKE_PTRARG(String); MAKE_PTRARG(Vector2); |