增加MNN模型支持
This commit is contained in:
@ -6,8 +6,7 @@
|
||||
#include <napi.h>
|
||||
|
||||
#define NODE_INIT_OBJECT(name, function) \
|
||||
do \
|
||||
{ \
|
||||
do { \
|
||||
auto obj = Napi::Object::New(env); \
|
||||
function(env, obj); \
|
||||
exports.Set(Napi::String::New(env, #name), obj); \
|
||||
@ -21,4 +20,13 @@ inline uint64_t __node_ptr_of__(Napi::Value value)
|
||||
|
||||
#define NODE_PTR_OF(type, value) (reinterpret_cast<type *>(__node_ptr_of__(value)))
|
||||
|
||||
|
||||
inline void *dataFromTypedArray(const Napi::Value &val, size_t &bytes)
|
||||
{
|
||||
auto arr = val.As<Napi::TypedArray>();
|
||||
auto data = static_cast<uint8_t *>(arr.ArrayBuffer().Data());
|
||||
bytes = arr.ByteLength();
|
||||
return static_cast<void *>(data + arr.ByteOffset());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user