From 4e1e08df618eae2c4a974dd26d6734900c8e2bf1 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Wed, 27 Sep 2023 17:57:40 +0800 Subject: [PATCH] ... --- include/pocketpy/bindings.h | 2 +- src/linalg.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/pocketpy/bindings.h b/include/pocketpy/bindings.h index 8670300d..50022550 100644 --- a/include/pocketpy/bindings.h +++ b/include/pocketpy/bindings.h @@ -113,7 +113,7 @@ void _bind(VM* vm, PyObject* obj, const char* sig, Ret(T::*func)(Params...)){ return VAR(self.REF().FGET()); \ }); -#define PY_STRUCT_LIKE_OBJECT(T) \ +#define PY_STRUCT_LIKE(T) \ static_assert(std::is_trivially_copyable::value); \ vm->bind_func<1>(type, "from_struct", [](VM* vm, ArgsView args){ \ C99Struct& s = CAST(C99Struct&, args[0]); \ diff --git a/src/linalg.cpp b/src/linalg.cpp index 62b2bb38..540bbdd8 100644 --- a/src/linalg.cpp +++ b/src/linalg.cpp @@ -42,7 +42,7 @@ namespace pkpy{ void PyVec2::_register(VM* vm, PyObject* mod, PyObject* type){ - PY_STRUCT_LIKE_OBJECT(PyVec2) + PY_STRUCT_LIKE(PyVec2) vm->bind_constructor<3>(type, [](VM* vm, ArgsView args){ float x = CAST_F(args[1]); @@ -101,7 +101,7 @@ namespace pkpy{ } void PyVec3::_register(VM* vm, PyObject* mod, PyObject* type){ - PY_STRUCT_LIKE_OBJECT(PyVec3) + PY_STRUCT_LIKE(PyVec3) vm->bind_constructor<4>(type, [](VM* vm, ArgsView args){ float x = CAST_F(args[1]); @@ -138,7 +138,7 @@ namespace pkpy{ } void PyVec4::_register(VM* vm, PyObject* mod, PyObject* type){ - PY_STRUCT_LIKE_OBJECT(PyVec4) + PY_STRUCT_LIKE(PyVec4) vm->bind_constructor<1+4>(type, [](VM* vm, ArgsView args){ float x = CAST_F(args[1]); @@ -183,7 +183,7 @@ namespace pkpy{ #undef BIND_VEC_FUNCTION_1 void PyMat3x3::_register(VM* vm, PyObject* mod, PyObject* type){ - PY_STRUCT_LIKE_OBJECT(PyMat3x3) + PY_STRUCT_LIKE(PyMat3x3) vm->bind_constructor<-1>(type, [](VM* vm, ArgsView args){ if(args.size() == 1+0) return VAR_T(PyMat3x3, Mat3x3::zeros());